ios - Pass NSManagedObject from one view controller to another -



ios - Pass NSManagedObject from one view controller to another -

i'm developing table view based app using coredata swift. i'm trying pas nsmanagedobject 1 view controller another. below code , error get.

in viewcontroller1.swift have next code:

override func prepareforsegue(segue: uistoryboardsegue!, sender: anyobject!) { if segue.identifier == "edit" { var selecteditem: nsmanagedobject = mydata[self.tableview.indexpathforselectedrow().row] nsmanagedobject allow vc2: viewcontroller2 = segue.destinationviewcontroller viewcontroller2 vc2.item = selecteditem } }

in viewcontroller2.swift:

class viewcontroller2: uiviewcontroller { @nsmanaged var item : nsmanagedobject override func viewdidload() { super.viewdidload() } // other default func }

error when segue viewcontroller2:

[_ttc6mydata18viewcontroller2 setitem:]: unrecognized selector sent instance 0x111530000

the @nsmanaged qualifier supposed used properties in nsmanagedobject subclass, shouldn't used in situation. should work,

class viewcontroller2: uiviewcontroller { var item : nsmanagedobject! override func viewdidload() { super.viewdidload() } // other default func }

ios core-data swift nsmanagedobject

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -