ios - Save custom class in Core Data in Swift -
i have tried way long time , couldn't find 1 can understand :(
i have custom class made:
public class player { private var name : string = "test" private var level : int = 1 private var skill : skill = skill("basic") //skill class }
i'm creating object class in view controller:
var player = player()
now wan't save player, have created entity called saves , attribute called playersaved , transformable type.
when save player playersaved crash "unrecognized selector sent instance".
thank :) hope done , finish app!
you need transform custom class nsmanagedobject
:
import coredata @objc(player) class player { @nsmanaged var name: string @nsmanaged var level: nsnumber @nsmanaged var skill: skill }
this standard way save "custom" classes in core data.
Comments
Post a Comment