Latest 1.0.0
Homepage https://github.com/BenziAhamed/Plist
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

A simple Swift library to work with plist files and data. Inspired by SwitfyJSON.

Usage

import Plist

// initialize using an NSDictionary
// and retrieve keyed values

let info = Plist(dict)
let name = info["name"].string ?? ""
let age = info["age"].int ?? 0

// initialize using an NSArray
// and retrieve indexed values

let 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+

Installation

Plist is available through CocoaPods. To install
it, simply add the following line to your Podfile:

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

License

Plist is available under the MIT license. See the LICENSE file for more info.

Contributions encouraged and welcome!

Latest podspec

{
    "name": "Plist",
    "version": "1.0.0",
    "summary": "A Swift framework to make working with plists easy.",
    "description": "Plist is a Swift library designed to make it easier to work the .plist files in Swift.nIt has an API inspired by SwiftyJSON library.",
    "homepage": "https://github.com/BenziAhamed/Plist",
    "license": "MIT",
    "authors": {
        "Benzi Ahamed": "[email protected]"
    },
    "source": {
        "git": "https://github.com/BenziAhamed/Plist.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "Plist/Classes/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This