• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

ijoshsmith/json2swift: A macOS command line tool that generates excellent Swift ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

ijoshsmith/json2swift

开源软件地址:

https://github.com/ijoshsmith/json2swift

开源编程语言:

Swift 100.0%

开源软件介绍:

json2swift

Overview

A macOS command line tool that generates excellent Swift data models based on JSON data.

It takes care of the boring error-prone grunt work of consuming JSON data in your app.

Feel free to modify the code it creates for you.

Written and unit tested in Swift 4.2.

Features

  • Generates immutable Swift struct definitions
  • Generates thread-safe code to create structs from JSON data
  • Performs sophisticated type inference to detect URLs, parse dates, etc.
  • Creates properties with required values whenever possible, but optional if necessary
  • Processes a single JSON file or a directory of JSON files

What is code generation?

Using a JSON-to-Swift code generator is very different from using a JSON library API. If you have never worked with a code generator before, check out this blog post for a quick overview.

How to get it

  • Download the json2swift app binary from the latest release
  • Copy json2swift to your desktop
  • Open a Terminal window and run this command to give the app permission to execute:
chmod +x ~/Desktop/json2swift

Or build the tool in Xcode yourself:

  • Clone the repository / Download the source code
  • Build the project
  • Open a Finder window to the executable file

How to find the executable

  • Drag json2swift from the Finder window to your desktop

How to install it

Assuming that the json2swift app is on your desktop…

Open a Terminal window and run this command:

cp ~/Desktop/json2swift /usr/local/bin/

Verify json2swift is in your search path by running this in Terminal:

json2swift

You should see the tool respond like this:

Error: Please provide a JSON file path or directory path.

Now that a copy of json2swift is in your search path, delete it from your desktop.

You're ready to go!


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap