Swiftpack.co -  iWECon/Lookup as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Quick access to key information in the dictionary. (快速获取字典中的键值信息,链式取值)
.package(url: "https://github.com/iWECon/Lookup.git", from: "1.0.3")



神奇 🤗️

当你有一段 JSON 时,你可以这样用:

// support json string to initialize
if let lookup = Lookup("{\"code\":200,\"msg\":\"success\",\"data\":{\"cat\":{\"id\":12345,\"name\":\"Kitty\"}}}") {
    lookup["data.cat.name"].string      // return Kitty,
    lookup["data.cat.age"].int          // return nil, bcz the key is not exists
    lookup["data.cat"].dict             // return the cat's dict
    // and, you can write code like this
    lookup.code.int         // return Optional(200)
    lookup.code.intValue    // return 200

或者你也可以通过 [String: Any?] 来初始化:

// supoort [String: Any?] to initialize
if let lookup = Lookup(["name": "iWECon", "age": 18, "height": 170, "brief": nil]) {
    // some codes...


Swift Package Manager

.package(url: "https://github.com/iWECon/Lookup", from: "1.0.0")


Stars: 1
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API