NSCoding

NSCoding 定义:

public protocol NSCoding {
    public func encode(with aCoder: NSCoder)
    public init?(coder aDecoder: NSCoder) // NS_DESIGNATED_INITIALIZER
}

一般情况下,UIView ,UIViewController ,都遵循了NSCoding protocol。 都要写(根据提示写就好了)

   required init?(coder aDecoder: NSCoder) {
       super.init(coder: aDecoder)
   }

你可能感兴趣的:(NSCoding)