Skip to content

Instantly share code, notes, and snippets.

@tempire
Last active November 5, 2015 11:44
Show Gist options
  • Save tempire/826e8676d47b8788148a to your computer and use it in GitHub Desktop.
Save tempire/826e8676d47b8788148a to your computer and use it in GitHub Desktop.
Within a NSManagedObject subclass called "Customer"
@NSManaged var pccf: PCCF?
func findOrCreatePCCF(context: NSManagedObjectContext) -> PCCF? {
if let pccf = self.pccf {
return pccf
}
let pccf = PCCF.createEntityInContext(context)
pccf.actorId = self.actorId
pccf.firstName = self.fname
pccf.lastName = self.lname
pccf.street = self.street1
pccf.city = self.city
pccf.county = self.county
pccf.state = self.state
pccf.zip = self.zip
pccf.phone = self.phone
pccf.mobilePhone = self.mobilePhone
pccf.email = self.email
//pccf.customer = self
self.pccf = pccf
return pccf
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment