Skip to content

sylvaingml/Swift-NSCoding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Swift and NSCoding

This is a very small example playground on how to use NSCoding with a Swift object.

You can implement NSCoding protocol but your object must use the Objective-C runtime. So you have two options:

  1. Use the @objc annotation on the class
  2. Extend the NSObject class

NSCoding is implemented by two methods:

  • init?(coder: NSCoder) is the constructor to be able to unfroze a serialized object.
  • encodeWithCoder(aCoder: NSCoder) will be used to serialize the object with the specified coding.

About

Example on how to use NSCoding in Swift

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages