Skip to content

JeanLebrument/APContact-EasyMapping

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

APContact+EasyMapping

Category to easily map APContact model with EasyMapping

Installation

Add the three folowing pods to your Podfile:

pod 'APAddressBook'
pod 'EasyMapping'
pod 'APContactEasyMapping'

Usage

Add the following include:

#import <APAddressBook/AddressBook.h>
#import <EasyMapping/EasyMapping.h>
#import "APContact+EasyMapping.h"

Example:

APAddressBook *addressBook = [[APAddressBook alloc] init];

addressBook.fieldsMask = APContactFieldAll;

[addressBook loadContacts:^(NSArray<APContact *> * _Nullable contacts, NSError * _Nullable error) {
  NSMutableArray *serializedContacts = [NSMutableArray array];
  
  for (APContact *contact in contacts) {
    [serializedContacts addObject:[contact serializeToDictionary]];
  }
}];