relopassociates.blogg.se

Objective c to swift migration
Objective c to swift migration









objective c to swift migration

Let personList: = NSKeyedUnarchiver.unarchiveObjectWithData(encodedObject) as! Let encodedObject: NSData = UD.objectForKey("key1") as! NSData UD.setObject(encodedObject, forKey: "key1") Let encodedObject: NSData = NSKeyedArchiver.archivedDataWithRootObject(personList) Inorder to make class more Objective C like I also tried prepending the class with is the code let UD = NSUserDefaults.standardUserDefaults().

objective c to swift migration

But changing the class name (back to KSPerson) did not solve the problem Initially I thought that it was due to different class names(in.

objective c to swift migration

I made following try outs, but still not able to figure out the solution It is giving an error :Įrror :: cannot decode object of class (KSPerson) for key (NS.objects) the class may be defined in source code or a library that is not linked I am facing a strange problem of User Defaults handling.(Since User preferences must not be changed in update)Īll the native type (like Bool, String) user preferences are working fine, but the the Class which was NSCoding compliant is not able to deserialse / Unarchive. I am working on an Update for my OS X app which was initially written in Obj-C.











Objective c to swift migration