Skip to content

Commit 78e62b1

Browse files
committed
Fix override for Swift 1.2. When using a base class, "override" will not be inserted for class methods of top-level entities unless the new template var "overrideBaseClass" is used.
1 parent 6f57408 commit 78e62b1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

templates/machine.swift.motemplate

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ class _<$managedObjectClassName$>: <$customSuperentity$> {
3434

3535
// MARK: - Class methods
3636

37-
<$if hasCustomSuperclass$>override <$endif$>public class func entityName () -> String {
37+
<$if (hasCustomSuperclass || (hasCustomSuperentity && TemplateVar.overrideBaseClass))$>override <$endif$>public class func entityName () -> String {
3838
return "<$name$>"
3939
}
4040

41-
<$if hasCustomSuperclass$>override <$endif$>public class func entity(managedObjectContext: NSManagedObjectContext!) -> NSEntityDescription! {
41+
<$if (hasCustomSuperclass || (hasCustomSuperentity && TemplateVar.overrideBaseClass))$>override <$endif$>public class func entity(managedObjectContext: NSManagedObjectContext!) -> NSEntityDescription! {
4242
return NSEntityDescription.entityForName(self.entityName(), inManagedObjectContext: managedObjectContext);
4343
}
4444

0 commit comments

Comments
 (0)