Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mattt committed Oct 30, 2012
0 parents commit 535375a
Show file tree
Hide file tree
Showing 12 changed files with 536 additions and 0 deletions.
19 changes: 19 additions & 0 deletions LICENSE
@@ -0,0 +1,19 @@
Copyright (c) 2012 Mattt Thompson (http://mattt.me/)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@@ -0,0 +1,224 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Identifier</key>
<string>com.afnetworking.template.project.AFIncrementalStore</string>
<key>Ancestors</key>
<array>
<string>com.apple.dt.unit.cocoaTouchApplication</string>
</array>
<key>Kind</key>
<string>Xcode.Xcode3.ProjectTemplateUnitKind</string>
<key>Options</key>
<array>
<dict>
<key>Default</key>
<string>false</string>
<key>Description</key>
<string>Whether the application should use the Core Data framework for storage</string>
<key>Identifier</key>
<string>coreData</string>
<key>Name</key>
<string>Use Core Data</string>
<key>SortOrder</key>
<integer>1</integer>
<key>Type</key>
<string>checkbox</string>
<key>Units</key>
<dict>
<key>true</key>
<dict>
<key>Definitions</key>
<dict>
<key>../Podfile:afincrementalstore</key>
<string>pod &quot;AFIncrementalStore&quot;</string>

<key>___PACKAGENAME___-Prefix.pch:objC:importCoreData</key>
<string>#import &lt;CoreData/CoreData.h&gt;</string>

<key>___PACKAGENAMEASIDENTIFIER___.xcdatamodeld</key>
<dict>
<key>Path</key>
<string>___PACKAGENAMEASIDENTIFIER___.xcdatamodeld</string>
<key>Group</key>
<string>Models</string>
</dict>

<key>___VARIABLE_classPrefix:identifier___AppDelegate.h:methods:coreData</key>
<string>@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;
- (void)saveContext;
</string>
<key>___VARIABLE_classPrefix:identifier___AppDelegate.m:applicationWillTerminate:comments</key>
<string>// Saves changes in the application's managed object context before the application terminates.
</string>
<key>___VARIABLE_classPrefix:identifier___AppDelegate.m:applicationWillTerminate:save</key>
<string>[self saveContext];
</string>
<key>___VARIABLE_classPrefix:identifier___AppDelegate.m:coreData</key>
<string>#pragma mark - Core Data
- (void)saveContext {
NSError *error = nil;
NSManagedObjectContext *managedObjectContext = self.managedObjectContext;
if (managedObjectContext) {
if ([managedObjectContext hasChanges] &amp;&amp; ![managedObjectContext save:&amp;error]) {
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
}
}
- (NSManagedObjectContext *)managedObjectContext {
if (_managedObjectContext) {
return _managedObjectContext;
}
NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];
if (coordinator) {
_managedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
[_managedObjectContext setPersistentStoreCoordinator:coordinator];
}
return _managedObjectContext;
}
- (NSManagedObjectModel *)managedObjectModel {
if (_managedObjectModel) {
return _managedObjectModel;
}
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"___PACKAGENAMEASIDENTIFIER___" withExtension:@"momd"];
_managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
return _managedObjectModel;
}
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator {
if (_persistentStoreCoordinator) {
return _persistentStoreCoordinator;
}
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
AFIncrementalStore *incrementalStore = (AFIncrementalStore *)[_persistentStoreCoordinator addPersistentStoreWithType:[___PACKAGENAMEASIDENTIFIER___IncrementalStore type] configuration:nil URL:nil options:nil error:nil];
NSURL *applicationDocumentsDirectory = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
NSURL *storeURL = [applicationDocumentsDirectory URLByAppendingPathComponent:@"___PACKAGENAMEASIDENTIFIER___.sqlite"];
NSDictionary *options = @{
NSInferMappingModelAutomaticallyOption : @(YES),
NSMigratePersistentStoresAutomaticallyOption: @(YES)
};
NSError *error = nil;
if (![incrementalStore.backingPersistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:&amp;error]) {
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
return _persistentStoreCoordinator;
}
</string>

<key>Classes/___PACKAGENAMEASIDENTIFIER___APIClient.h</key>
<dict>
<key>Beginning</key>
<string>#import "AFIncrementalStore.h"
#import "AFRestClient.h"
@interface ___PACKAGENAMEASIDENTIFIER___APIClient : AFRESTClient &lt;AFIncrementalStoreHTTPClient&gt;
+ (___PACKAGENAMEASIDENTIFIER___APIClient *)sharedClient;
</string>
<key>End</key>
<string>@end</string>
<key>Group</key>
<key>Networking</key>
</dict>

<key>Classes/___PACKAGENAMEASIDENTIFIER___APIClient.m:AFIncrementalStore</key>
<string>#pragma mark - AFIncrementalStore
- (id)representationOrArrayOfRepresentationsFromResponseObject:(id)responseObject {
return responseObject;
}
- (NSDictionary *)attributesForRepresentation:(NSDictionary *)representation
ofEntity:(NSEntityDescription *)entity
fromResponse:(NSHTTPURLResponse *)response
{
NSMutableDictionary *mutablePropertyValues = [[super attributesForRepresentation:representation ofEntity:entity fromResponse:response] mutableCopy];
// Customize the response object to fit the expected attribute keys and values
return mutablePropertyValues;
}
- (BOOL)shouldFetchRemoteAttributeValuesForObjectWithID:(NSManagedObjectID *)objectID
inManagedObjectContext:(NSManagedObjectContext *)context
{
return NO;
}
- (BOOL)shouldFetchRemoteValuesForRelationship:(NSRelationshipDescription *)relationship
forObjectWithID:(NSManagedObjectID *)objectID
inManagedObjectContext:(NSManagedObjectContext *)context
{
return NO;
}
</string>

<key>Classes/___PACKAGENAMEASIDENTIFIER___IncrementalStore.h</key>
<dict>
<key>Path</key>
<string>___PACKAGENAMEASIDENTIFIER___IncrementalStore.h</string>
<key>Group</key>
<string>Networking</string>
</dict>

<key>Classes/___PACKAGENAMEASIDENTIFIER___IncrementalStore.m</key>
<dict>
<key>Path</key>
<string>___PACKAGENAMEASIDENTIFIER___IncrementalStore.m</string>
<key>Group</key>
<string>Networking</string>
</dict>
</dict>
<key>Nodes</key>
<array>
<string>../Podfile:afincrementalstore</string>
<string>___PACKAGENAMEASIDENTIFIER___.xcdatamodeld</string>
<string>___VARIABLE_classPrefix:identifier___AppDelegate.h:methods:coreData</string>
<string>___VARIABLE_classPrefix:identifier___AppDelegate.h:import:___PACKAGENAMEASIDENTIFIER___IncrementalStore.h</string>
<string>___VARIABLE_classPrefix:identifier___AppDelegate.m:implementation:synthesize:managedObjectContext = _managedObjectContext</string>
<string>___VARIABLE_classPrefix:identifier___AppDelegate.m:implementation:synthesize:managedObjectModel = _managedObjectModel</string>
<string>___VARIABLE_classPrefix:identifier___AppDelegate.m:implementation:synthesize:persistentStoreCoordinator = _persistentStoreCoordinator</string>
<string>___VARIABLE_classPrefix:identifier___AppDelegate.m:implementation:dealloc:_managedObjectContext</string>
<string>___VARIABLE_classPrefix:identifier___AppDelegate.m:implementation:dealloc:_managedObjectModel</string>
<string>___VARIABLE_classPrefix:identifier___AppDelegate.m:implementation:dealloc:_persistentStoreCoordinator</string>
<string>___VARIABLE_classPrefix:identifier___AppDelegate.m:applicationWillTerminate:save</string>
<string>___VARIABLE_classPrefix:identifier___AppDelegate.m:coreData</string>
<string>___PACKAGENAME___-Prefix.pch:objC:importCoreData</string>
<string>Classes/___PACKAGENAMEASIDENTIFIER___APIClient.m:AFIncrementalStore</string>
<string>Classes/___PACKAGENAMEASIDENTIFIER___IncrementalStore.h</string>
<string>Classes/___PACKAGENAMEASIDENTIFIER___IncrementalStore.m</string>
</array>
<key>Targets</key>
<array>
<dict>
<key>Frameworks</key>
<array>
<string>CoreData</string>
</array>
</dict>
</array>
</dict>
</dict>
</dict>
</array>
</dict>
</plist>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model name="Test1.xcdatamodel" userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="1" systemVersion="11A491" minimumToolsVersion="Automatic" macOSVersion="Automatic" iOSVersion="Automatic">
<elements/>
</model>
@@ -0,0 +1,6 @@

#import "AFIncrementalStore.h"

@interface ___PACKAGENAMEASIDENTIFIER___IncrementalStore : AFIncrementalStore

@end
@@ -0,0 +1,22 @@
#import "___PACKAGENAMEASIDENTIFIER___IncrementalStore.h"
#import "___PACKAGENAMEASIDENTIFIER___APIClient.h"

@implementation ___PACKAGENAMEASIDENTIFIER___IncrementalStore

+ (void)initialize {
[NSPersistentStoreCoordinator registerStoreClass:self forStoreType:[self type]];
}

+ (NSString *)type {
return NSStringFromClass(self);
}

+ (NSManagedObjectModel *)model {
return [[NSManagedObjectModel alloc] initWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"___PACKAGENAMEASIDENTIFIER___" withExtension:@"xcdatamodeld"]];
}

- (id <AFIncrementalStoreHTTPClient>)HTTPClient {
return [___PACKAGENAMEASIDENTIFIER___APIClient sharedClient];
}

@end
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Identifier</key>
<string>com.afnetworking.template.project.AFNetworking</string>
<key>Name</key>
<string>AFNetworking Dependency</string>
<key>Ancestors</key>
<array>
</array>
<key>Definitions</key>
<dict>
<key>../Podfile:afnetworking</key>
<string>pod &quot;AFNetworking&quot;</string>

<key>___PACKAGENAME___-Prefix.pch:objC:importSystemConfiguration</key>
<string>#import &lt;SystemConfiguration/SystemConfiguration.h&gt;</string>
<key>___PACKAGENAME___-Prefix.pch:objC:importCoreServices</key>
<string>#import &lt;MobileCoreServices/MobileCoreServices.h&gt;</string>

<key>Classes/___PACKAGENAMEASIDENTIFIER___APIClient.h</key>
<dict>
<key>Beginning</key>
<string>#import "AFHTTPClient.h"
@interface ___PACKAGENAMEASIDENTIFIER___APIClient : AFHTTPClient
+ (___PACKAGENAMEASIDENTIFIER___APIClient *)sharedClient;
</string>
<key>End</key>
<string>@end</string>
<key>Group</key>
<key>Networking</key>
</dict>

<key>Classes/___PACKAGENAMEASIDENTIFIER___APIClient.m</key>
<dict>
<key>Beginning</key>
<string>#import "___PACKAGENAMEASIDENTIFIER___APIClient.h"
#import "AFJSONRequestOperation.h"
static NSString * const k___PACKAGENAMEASIDENTIFIER___APIBaseURLString = @"&lt;# API Base URL #&gt;";
@implementation ___PACKAGENAMEASIDENTIFIER___APIClient
+ (___PACKAGENAMEASIDENTIFIER___APIClient *)sharedClient {
static ___PACKAGENAMEASIDENTIFIER___APIClient *_sharedClient = nil;
static dispatch_once_t onceToken;
dispatch_once(&amp;onceToken, ^{
_sharedClient = [[self alloc] initWithBaseURL:[NSURL URLWithString:k___PACKAGENAMEASIDENTIFIER___APIBaseURLString]];
});
return _sharedClient;
}
- (id)initWithBaseURL:(NSURL *)url {
self = [super initWithBaseURL:url];
if (!self) {
return nil;
}
[self registerHTTPOperationClass:[AFJSONRequestOperation class]];
[self setDefaultHeader:@"Accept" value:@"application/json"];
return self;
}
</string>
<key>End</key>
<string>@end</string>
<key>Group</key>
<key>Networking</key>
</dict>
</dict>
<key>Description</key>
<string></string>
<key>Kind</key>
<string>Xcode.Xcode3.ProjectTemplateUnitKind</string>
<key>Nodes</key>
<array>
<string>../Podfile:afnetworking</string>
<string>___PACKAGENAME___-Prefix.pch:objC:importSystemConfiguration</string>
<string>___PACKAGENAME___-Prefix.pch:objC:importCoreServices</string>
<string>Classes/___PACKAGENAMEASIDENTIFIER___APIClient.h</string>
<string>Classes/___PACKAGENAMEASIDENTIFIER___APIClient.m</string>
</array>
<key>Options</key>
<array>
</array>
<key>SortOrder</key>
<integer>1</integer>
</dict>
</plist>

0 comments on commit 535375a

Please sign in to comment.