LBJSON
LBJSON 是一个Swift框架,使用枚举对象来解析JSON。
如何使用
// LBJSON enum properties int, double, bool, string, number, array and dictionary returns the associated values or nil
// Instead of casting you can use optional chaining.
if let posts = LBJSON(object: [["key":"Value"]]) {
var post = posts.array?.first?.dictionary?["key"]?.string
}
// With @dynamicMemberLookup
if let posts = LBJSON(object: [["key":"Value"]]) {
var post = posts.array?.first?.key?.string
}
CocoaPods
CocoaPods 是 Cocoa 项目的依赖管理器。
CocoaPods 0.36 添加了对 Swift 和嵌入式框架的支持。您可以使用以下命令安装它
$ gem install cocoapods
要使用 CocoaPods 将 LBJSON 集成到您的 Xcode 项目中,在您的 Podfile
中指定它
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
pod 'LBJSON'
然后,运行以下命令
$ pod install
许可
此内容根据 MIT 许可证发布 https://github.com/lucianboboc/LBJSON/blob/master/LICENSE.md
祝你享受!