iOS 开发实用技术导航
NSHipster 中文版
› http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
› http://www.cocos2d-iphone.org/
CocoaPods
› http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
› http://code.google.com/mobile/analytics/
WWDC
› https://developer.apple.com/wwdc/
Design Guides and Resources
› https://developer.apple.com/design/
Transcripts of WWDC sessions
› http://asciiwwdc.com
Cocoa with Love
› http://cocoawithlove.com/
Cocoa Dev Central
› http://cocoadevcentral.com/
NSHipster
› http://nshipster.com/
Style Guides
› Google Objective-C Style Guide
› NYTimes Objective-C Style Guide
Useful Tools and Services
› Charles Web Debugging Proxy
› Smore
CommandZi
V2EX  ›  iDev

SamllJSONParser - 一个小巧的基于 Swift 4.2 写的 JSON 解析库

  •  
  •   CommandZi · Sep 13, 2018 · 3302 views
    This topic created in 2948 days ago, the information mentioned may be changed or developed.

    昨晚边看苹果发布会直播,边敲出来。基于 Swift 4.2 的 Dynamic Member Lookup 特性。

    特点上一段代码一目了然,一共就 200 多行代码。

    let string = "{\"id\": 923, \"name\": \"hello\"}"
    let json = JSON.parse(string: string)
    let id = json.id.intValue    //   923
    let name: String = json.name    //   hello
    

    嗯,一点点 Python 的味道。 思路来自 Introduce User-defined "Dynamic Member Lookup" Types 。 另外还有一个 dynamicCallable 特性处于 Coming soon,值得期待

    欢迎提 Issue、Star、Fork。地址 SmallJSONParser

    agagega
        1
    agagega  
       Sep 13, 2018
    我怎么感觉像是 JavaScript 的味道
    CommandZi
        2
    CommandZi  
    OP
       Sep 13, 2018
    @agagega 是的,就是类似动态类型语言
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   939 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 19:55 · PVG 03:55 · LAX 12:55 · JFK 15:55
    ♥ Do have faith in what you're doing.