For now this repo is a personal exercise in implementing in a TDD manner a Plist representation inspired by PropertyList which is inspired by SwiftyJSON
Swift 4.0 introduced the Codable protocol, that can be use with JSON, but that can also be used with property list. Moving forward you should look into that option.
let inputDic = plistDictionaryFromFile()
var plist = Plist(plistObject: inputDic)
let str = plist["array"]?[1].string
let float = plist["float"]?.number as? Float
plist["float"] = 1.1
This may change after starting using it in real life situation
- Avoid all the type casting needed when using the Appel's API alone
- Allow chained subscript access to items in the property list
- Keep the optional nature of dictionary access
- Keep the out of bound crash of array access
- Assume that the plist format is known by the calling code (e.g. what kind of number you are suppose to have for a given key)
- Keep
Plist
astruct
to have better control over mutability and have value semantic. - Version number match Swift version. e.g. Version 1.2.x are version written for Swift 1.2.
iOS 8.0 (might work on OSX and iOS 7, but not tested (officially supported) on those system)
SwiftyPlist is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "SwiftyPlist"
Vincent Bernier