V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
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
banxi1988
V2EX  ›  iDev

从 API 到 Model: 我是这样做的

  •  
  •   banxi1988 ·
    banxi1988 · 2016-12-22 17:53:41 +08:00 · 3089 次点击
    这是一个创建于 2688 天前的主题,其中的信息可能已经有所发展或是发生改变。

    今年将原来代码生成脚本重写了下. 思来想去,虽然自己觉得很有用. 但是还是拿出来让大家看看. 独乐乐不如众乐乐.

    开源代码倒比较简单, 只是文档也要跟上才好.

    今天更新了第一个使用示例文档. 从 API 到 Model

    简而言之,做法只是简单的两步.

    1. json to fields
    2. fields to model

    闲话少说, 具体使用说明见:

    https://github.com/banxi1988/iOSCodeGenerator

    [使用动图

    4 条回复    2016-12-23 18:04:50 +08:00
    qwer1234asdf
        1
    qwer1234asdf  
       2016-12-22 20:08:23 +08:00 via iPhone
    像 cakephp 的 model 那样么?
    banxi1988
        2
    banxi1988  
    OP
       2016-12-23 07:46:08 +08:00
    @qwer1234asdf
    我对 cakephp 不熟悉. 但是应该不是这样的.
    我这是提供速写及转换的手法.
    twoyuan
        3
    twoyuan  
       2016-12-23 16:41:25 +08:00
    赞,应该和 Android Studio 的 GsonFormat 差不多
    banxi1988
        4
    banxi1988  
    OP
       2016-12-23 18:04:50 +08:00
    @twoyuan 看了下 GsonFormat 确实差不多.
    不过我没有做成 IDE 插件, 而是添加系统服务的方式使用.
    也没有提供 GUI 界面, 而是直接书写. 提供简写. 使用起来比较方便.
    不过看来我需要添加一个怎么添加 Automator 服务的说明.
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   720 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 20:51 · PVG 04:51 · LAX 13:51 · JFK 16:51
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.