-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New mapping macros using VOKKeyPathHelper #73
Conversation
Deprecated VOK_MAP_FOREIGN_TO_LOCAL in favor of two new helper macros, VOK_CDSELECTOR in favor of macros in VOKKeyPathHelper.
(Needs pod install.)
specify the class name before the class property name to let Xcode help with autocomplete.
Use a module map to include the non-module header VOKKeyPathHelper. This fixes the "include of non-modular header inside framework module" error in Xcode 7 when use_frameworks is enabled. This subspec is included by default for Obj-C, but excluded for Swift because the macros are only usable from Obj-C code.
Grate werk separating pod updates from the rest of the change 😑 |
@@ -50,7 +52,7 @@ or | |||
|
|||
Vokoder offers a lightweight mapper for importing Foundation objects into Core Data. Arrays of dictionaries can be imported with ease once maps are set up. If no maps are provided Vokoder will use its default maps. The default maps assume that foreign keys have the same names as your core data attributes. It will make its best effort to identify dates and numbers. | |||
|
|||
Setting up your own maps is recommended. Macros are provided to make it fun and easy. Below is an example of setting up a mapper for an arbitrary managed object subclass. Mappers are not persisted between app launches, so be sure to setup your maps every time your application starts. | |||
Setting up your own maps is recommended. Macros are provided to make it fun and easy. Below is an example of setting up a mapper for a managed object subclass `VOKPerson`. Mappers are not persisted between app launches, so be sure to setup your maps every time your application starts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Macros are provided to make it fun and easy" 😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you may have written that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sooooo charming!
I can redo this with the pod updates split out, but Travis will fail. |
I wasn't seriously complaining about the pods. |
*/ | ||
#ifndef VOKMapForeignToLocalClassProperty | ||
# define VOKMapForeignToLocalClassProperty(inputKeyPath, klass, coreDataSelectorSymbol) \ | ||
[VOKManagedObjectMap mapWithForeignKeyPath:inputKeyPath coreDataKey:VOKKeyForInstanceOf(klass, coreDataSelectorSymbol)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were it me, I'd indent these macro line continuations to be one level deeper than the define
, but Xcode will keep trying to put them back outdented to here, so it may not be worth it.
Given the project file noise, we probably should apply xUnique to all the project files, but I don't know that it's worth doing on this PR. |
README formatting updates pushed |
@@ -170,7 +172,7 @@ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{ | |||
NSManagedObjectContext *backgroundContext = [[VOKCoreDataManager sharedInstance] temporaryContext]; | |||
|
|||
SomeManagedObjectSubclass *thing = [SomeManagedObjectSubclass vok_newInstanceWithContext:backgroundContext]; | |||
thing.someArbitrayAttribute = @"hello"; | |||
thing.someArbitrayAttribute = @"hello"; | |||
[[VOKCoreDataManager sharedInstance] saveAndMergeWithMainContext:backgroundContext]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation here looks funny to me. Am I missing something? Is it a GitHub quirk?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed converting a tab to spaces
That goat does not want to dance |
I’ll make another PR adding xUnique before releasing these macro changes to pod trunk |
New mapping macros using VOKKeyPathHelper
Wow. @vokal-isaac Great "goat to pull" |
@seanwolter @vokal-isaac For real. Saved for future use. |
Every once in a while, particularly for @chillpop, I try to find one we haven't used before. |
@vokal-isaac started with this:
VOK_CDSELECTOR
andVOK_MAP_FOREIGN_TO_LOCAL
macros.I took over and did this:
@vokal/ios-developers, @seanwolter, code review?