Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mustafa/SwiftCoding
Automatic NSCoding for Swift
https://github.com/mustafa/SwiftCoding
Last synced: 3 months ago
JSON representation
Automatic NSCoding for Swift
- Host: GitHub
- URL: https://github.com/mustafa/SwiftCoding
- Owner: mustafa
- License: mit
- Created: 2015-05-11T15:11:30.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-12-21T02:05:49.000Z (about 9 years ago)
- Last Synced: 2024-08-03T14:10:20.871Z (7 months ago)
- Language: Swift
- Size: 137 KB
- Stars: 27
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SwiftCoding
Automatic NSCoding for Swift### Installing
Just add `SwiftCoding.swift` to your project.
### Example
```swift
@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
[]