Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/naoty/ntyfactory
Data bootstrapping factory for Core Data.
https://github.com/naoty/ntyfactory
Last synced: 21 days ago
JSON representation
Data bootstrapping factory for Core Data.
- Host: GitHub
- URL: https://github.com/naoty/ntyfactory
- Owner: naoty
- License: mit
- Created: 2014-04-27T16:45:48.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-04-28T14:41:37.000Z (over 10 years ago)
- Last Synced: 2024-10-22T14:01:57.804Z (2 months ago)
- Language: Objective-C
- Size: 141 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# NTYFactory
[![Version](http://cocoapod-badges.herokuapp.com/v/NTYFactory/badge.png)](http://cocoadocs.org/docsets/NTYFactory)
[![Platform](http://cocoapod-badges.herokuapp.com/p/NTYFactory/badge.png)](http://cocoadocs.org/docsets/NTYFactory)## Usage
### Basic
```objective-c
// Define factory
NTYFactory *userFactory = [NTYFactory factoryWithManagedObjectContext:context entityName:@"User" defaultProperties:@{
@"name": @"Alice",
@"age": @18
}];// Create an object
NSManagedObject *defaultUser = [userFactory create];
NSManagedObject *bob = [userFactory createWithProperties:@{@"name": @"Bob", @"age": @19}];// Create objects
NSArray *users = [userFactory createListWithPropertiesList:@[
@{@"name": @"Charlie"},
@{@"name": @"Dave", @"age": @19},
@{@"name": @"Ellen", @"age": @20}
]];
```### Sequence
```objective-c
NTYFactory *userFactory = [NTYFactory factoryWithManagedObjectContext:context entityName:@"User" defaultProperties:@{
@"name": [NTYSequentialString stringWithFormat:@"User %@" from:@1],
@"age": [NTYSequentialNumber numberFromNumber:@18 step:@3]
}];NSArray *users = [userFactory createListByNumber:@10];
```