TestsTested | ✓ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Arnaud Coomans.
Populate is both an iOS app and library to easily create random-generated contacts.
pod install
You can tap contacts to open the address book without switching apps.
** Be careful not to erase your real contact if you use Populate on a real device **
You can either clone this repository and add the files in the PopulateKit directory to your project; or use CocoaPods.
Add a pod entry to your Podfile:
pod 'PopulateKit', '~> 0.0.4'
Install the pod(s) by running:
pod install
Import the header
#import "PopulateKit.h"
To add hand-made contacts to the address book, create the contacts with the ACPerson wrapper and add them to Test group in the address book:
ACPerson *personA = [[ACPerson alloc] initWithFirstname:@"Alice"
lastName:@"A"
email:@"[email protected]"
phone:@"555-111-1111"
image:nil];
ACPerson *personB = [[ACPerson alloc] initWithFirstname:@"Bob"
lastName:@"B"
email:@"[email protected]"
phone:@"555-222-2222"
image:nil];
ACPerson *personC = [[ACPerson alloc] initWithFirstname:@"Charlie"
lastName:@"C"
email:@"[email protected]"
phone:@"555-333-3333"
image:nil];
[ACPopulate populateGroupWithName:@"Test"
withPersons:@[personA, personB, personC]
completion:nil];
To add randomly-generated contacts instead, use a ACPersonSet:
[ACPopulate populateGroupWithName:@"Test"
withCountOfPersons:10
fromSet:[ACPersonSet personSetWithRandomNameAndImage]
completion:nil];
It is possible to populate with a custom ACPersonSet by using data sets (ACNameSet and ACImageSet). Here is an example of populating with random first names, common US surnames and identicon avatars:
[ACPopulate populateGroupWithName:@"Test"
withCountOfPersons:10
fromSet:[ACPersonSet setWithFirstNameSet:[ACNameSet randomNameSet]
lastNameSet:[ACNameSet commonSurnameSet]
imageSet:[ACImageSet identiconImageSet]
completion:nil];
Or you can supply multiple ACPersonSet, like a male and a female set:
[ACPopulate populateGroupWithName:@"Test"
withCountOfPersons:10
fromSets:@[
[ACPersonSet setWithFirstNameSet:[ACNameSet commonMaleNameSet]
lastNameSet:[ACNameSet commonSurnameSet]
imageSet:[ACImageSet maleFaceImageSet]],
[ACPersonSet setWithFirstNameSet:[ACNameSet commonFemaleNameSet]
lastNameSet:[ACNameSet commonSurnameSet]
imageSet:[ACImageSet femaleFaceImageSet]]
]
completion:nil];
If you want to delete the Test group and all its members from the addess book:
[ACPopulate depopulateGroupWithName:@"Test" completion:nil];
You can also have a look at the Populate app for inspiration.
If you want to use randomly-generated contacts directly:
ACPersonSet *personSet = [ACPersonSet setWithFirstNameSet:[ACNameSet randomNameSet]
lastNameSet:[ACNameSet commonSurnameSet]
imageSet:[ACImageSet identiconImageSet]];
ACPerson *person = [personSet randomPerson];
NSLog(@"%@", person.firstName);
If you have appledoc installed, you can generate the documentation by running the corresponding target.