ios - How to make a designated initializer for NSManagedObject subclass in Swift? -


  class alternative: NSManagedObject {@NSManaged on text: String isCorrect on @NSManaged: Image @NSManaged on Bull: NSData } feature init (text: string, isCorrect: Buhl, unit: NSEntityDescription, insertIntoManagedObjectContext reference: NSManagedObjectContext) {optionally = optional (unit: unit, insertIntoManagedObjectContext: reference) = text alternative.isCorrect = isCorrect return as alternative alternative.text Option}  

I want to create a method that lets me start new items with this call: <

But I get an error:

  Optional should be representative with the feature self.init  
P> Why do I need to convert my initalizer to work for my example?

after"

a feature Starter must Starter calls the designated self :

< Pre> utility init (text: st Banking, isCorrect: Buhl, unit: NSEntityDescription, insertIntoManagedObjectContext reference: NSManagedObjectContext) {self.init (unit: unit, insertIntoManagedObjectContext: Reference) self.text = text self.isCorrect = isCorrect} New Adulver = Optional (text: "third platform", true: true, unit: description of entity, insert engine ignored contact: managed object contexes):

In addition, you can also place the details of the unit in the feature initiator You can transfer, it induced in response to (head, rather than as an argument):

  feature init (text: string, right: Object contact reference in Buhl, including karentaiba : NSManagedObjectContext!) {Enter unit = NSEntityDescriptio N.entityForName ("Optional", Managed Object Contains: Reference)! self.init (unit: unit, insertIntoManagedObjectContext: Reference) self.text = text self.isCorrect = isCorrect}  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -