APAddressBook icon indicating copy to clipboard operation
APAddressBook copied to clipboard

APContact should be copy-able

Open vivekReddyBlackBuck opened this issue 7 years ago • 4 comments

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

vivekReddyBlackBuck avatar Sep 26 '16 20:09 vivekReddyBlackBuck

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

belkevich avatar Oct 03 '16 13:10 belkevich

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 avatar Oct 03 '16 18:10 vivekReddyBlackBuck

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

vivekReddyBlackBuck avatar Oct 03 '16 18:10 vivekReddyBlackBuck

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

belkevich avatar Nov 20 '16 13:11 belkevich