Skip to content

Instantly share code, notes, and snippets.

@Bashta
Created August 31, 2015 11:14
Show Gist options
  • Save Bashta/d5ac0b3ecba8ba951f69 to your computer and use it in GitHub Desktop.
Save Bashta/d5ac0b3ecba8ba951f69 to your computer and use it in GitHub Desktop.
Core Data bypasses initialization rules because of @NSManaged. This is a dependency injection of the class Employee
class Employee: NSManagedObject {
init(context: NSManagedObjectContext,
name: String,
dateOfBirth: NSDate,
salary: NSDecimalNumber,
employeeId: String = NSUUID().UUIDString,
email: String? = nil,
address: String? = nil) {
// init
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment