Skip to content

Commit

Permalink
Replaced [NSDictionary dictionaryWithObjectsAndKeys] with @{obj: key}…
Browse files Browse the repository at this point in the history
… literal
  • Loading branch information
MeXx committed Aug 26, 2015
1 parent 6a92ab5 commit 7b4d9fa
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions templates/machine.m.motemplate
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,22 @@ const struct <$managedObjectClassName$>UserInfo <$managedObjectClassName$>UserIn

NSManagedObjectModel *model = [[moc_ persistentStoreCoordinator] managedObjectModel];
<$if FetchRequest.hasBindings$>
<$if TemplateVar.literals$>
NSDictionary *substitutionVariables = @{<$foreach Binding FetchRequest.bindings doVar$>@"<$Binding.name$>": <$Binding.name$>_<$if BindingIndex < FetchRequest.bindings.@count - 1$>, <$endif$><$endforeach doVar$>};
<$else$>
NSDictionary *substitutionVariables = [NSDictionary dictionaryWithObjectsAndKeys:
<$foreach Binding FetchRequest.bindings do2$>
<$Binding.name$>_, @"<$Binding.name$>",
<$endforeach do2$>
nil];
<$endif$>
<$else$>
<$if TemplateVar.literals$>
NSDictionary *substitutionVariables = @{};
<$else$>
NSDictionary *substitutionVariables = [NSDictionary dictionary];
<$endif$>
<$endif$>
NSFetchRequest *fetchRequest = [model fetchRequestFromTemplateWithName:@"<$FetchRequest.name$>"
substitutionVariables:substitutionVariables];
NSAssert(fetchRequest, @"Can't find fetch request named \"<$FetchRequest.name$>\".");
Expand Down Expand Up @@ -188,14 +196,22 @@ const struct <$managedObjectClassName$>UserInfo <$managedObjectClassName$>UserIn

NSManagedObjectModel *model = [[moc_ persistentStoreCoordinator] managedObjectModel];
<$if FetchRequest.hasBindings$>
<$if TemplateVar.literals$>
NSDictionary *substitutionVariables = @{<$foreach Binding FetchRequest.bindings doVar$>@"<$Binding.name$>": <$Binding.name$>_<$if BindingIndex < FetchRequest.bindings.@count - 1$>, <$endif$><$endforeach doVar$>};
<$else$>
NSDictionary *substitutionVariables = [NSDictionary dictionaryWithObjectsAndKeys:
<$foreach Binding FetchRequest.bindings do2$>
<$Binding.name$>_, @"<$Binding.name$>",
<$endforeach do2$>
nil];
<$endif$>
<$else$>
<$if TemplateVar.literals$>
NSDictionary *substitutionVariables = @{};
<$else$>
NSDictionary *substitutionVariables = [NSDictionary dictionary];
<$endif$>
<$endif$>
NSFetchRequest *fetchRequest = [model fetchRequestFromTemplateWithName:@"<$FetchRequest.name$>"
substitutionVariables:substitutionVariables];
NSAssert(fetchRequest, @"Can't find fetch request named \"<$FetchRequest.name$>\".");
Expand Down

0 comments on commit 7b4d9fa

Please sign in to comment.