Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APContact should be copy-able #139

Open
vivekReddyBlackBuck opened this issue Sep 26, 2016 · 4 comments
Open

APContact should be copy-able #139

vivekReddyBlackBuck opened this issue Sep 26, 2016 · 4 comments

Comments

@vivekReddyBlackBuck
Copy link

user has 3 phone numbers , want to show them as rows in a table , if would be able to copy the APPerson contact , then it would be easy

@belkevich
Copy link
Contributor

Sorry, I don't understand what exactly you can't copy?

@vivekReddyBlackBuck
Copy link
Author

How do I create a copy of APContact object? If I assign Apcontact object to some variable , then I have a reference but I want a copy so that I can modify one of them and have 2 objects

@vivekReddyBlackBuck
Copy link
Author

I think we need to implement copywithzone method , which is not there currently or is there any other method to make a copy and assign it to another variable

@belkevich
Copy link
Contributor

Sorry, for delay.

  1. Most of APAddressBook users expect that copy doesn't create so called 'deep copy'. But you can create the category for APContact class with your own copy/copyWithZone: method implementation and use it in your project.
  2. You can create something like ContactsTableViewModel class that will store copies of APContact fields in format (for phones numbers?) that you exactly need. I think it's a best approach to avoid mutating original object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants