Skip to content

mustafa/SwiftCoding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwiftCoding

Automatic NSCoding for Swift

Installing

Just add SwiftCoding.swift to your project.

Example

@objc public class Book: NSObject, NSCoding {
    dynamic var title: String?
    dynamic var author: String?
    dynamic var pageCount: NSNumber?
    dynamic var categories: [String]?
    dynamic var available: NSNumber?
    
    // MARK: NSCoding
    
    required convenience public init(coder decoder: NSCoder) {
        self.init()
        setupWithCoder(coder: decoder)
    }
    
    public func encodeWithCoder(coder: NSCoder) {
        encode(coder)
    }
}

Contributing

Pull requests are welcome!

TODO:

[] Add support for Swift types that are not representable in Obj-C

[]

About

Automatic NSCoding for Swift

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages