https://github.com/benziahamed/plist
Plist is a Swift framework to make working with plist files easy
https://github.com/benziahamed/plist
plist plist-files swift swift3 utility-library
Last synced: about 1 month ago
JSON representation
Plist is a Swift framework to make working with plist files easy
- Host: GitHub
- URL: https://github.com/benziahamed/plist
- Owner: BenziAhamed
- License: mit
- Created: 2016-04-23T12:57:03.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-12-17T07:46:32.000Z (almost 6 years ago)
- Last Synced: 2025-04-13T14:07:25.212Z (6 months ago)
- Topics: plist, plist-files, swift, swift3, utility-library
- Language: Swift
- Homepage:
- Size: 42 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Plist
[](https://travis-ci.org/BenziAhamed/Plist)
[](http://cocoapods.org/pods/Plist)
[](http://cocoapods.org/pods/Plist)
[](http://cocoapods.org/pods/Plist)A simple Swift library to work with plist files and data. Inspired by SwitfyJSON.
## Usage
```swift
import Plist// initialize using an NSDictionary
// and retrieve keyed valueslet info = Plist(dict)
let name = info["name"].string ?? ""
let age = info["age"].int ?? 0// initialize using an NSArray
// and retrieve indexed valueslet info = Plist(array)
let itemAtIndex0 = info[0].value// load an applications info.plist data
let info = Plist(NSBundle.mainBundle().infoDictionary)
let identifier = info["CFBundleIndentifier"].string!// utility initiaizer to load a plist file at specified path
let info = Plist(path: "path_to_plist_file")// we support index chaining - you can get to a dictionary from an array via
// a dictionary and so on
// don't worry, the following will not fail with errors in case
// the index path is invalid
if let complicatedAccessOfSomeStringValueOfInterest = info["dictKey"][10]["anotherKey"].string {
// do something
}
else {
// data cannot be indexed
}// you can also re-use parts of a plist data structure
let info = Plist(...)
let firstSection = info["Sections"][0]["SectionData"]
let sectionKey = firstSection["key"].string!
let sectionSecret = firstSection["secret"].int!```
NOTE: To run the example project, clone the repo, and run `pod install` from the Example directory first.
## Requirements
iOS 8+, Swift 3.0
## Installation
Plist is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:```ruby
pod "Plist"
```### Manual Install
Copy over Plist.swift and place in a project of your choice, including it in your build.
## Author
Benzi Ahamed, [Twitter](https://twitter.com/BenziAhamed)
## License
Plist is available under the MIT license. See the LICENSE file for more info.
Contributions encouraged and welcome!