auto convert json string to swift struct.中文介绍
-
How to use?
-
- Input json to left
-
- click "convert=>"
-
- Copy the result Parameters statement:
-
ObjectMapper: Simple JSON Object mapping written in Swift. If this is selected, result will auto add func mapping
-
name: the name of the result, default is "Result"
-
prefix: the prefix of each struct name, default is empty.
-
- open Terminal, cd to Main.py
-
- Copy json string to File named "jsons.txt"
-
- Python3 Main.py
-
- ResultModel.swift is the result
-
CocoaPython: a fast way to use python with Cocoa. we can use CocoaPython.swift like this:
// python path guard let aPath = Bundle.main.path(forResource: "Parse", ofType: "py") else { return } // args: python accept paras // block: complete block let script = CocoaPython(scrPath: aPath, args: [""]) { [weak self] in print($0) // python's return print($1) // python's Error } script.spliPara = "$" // the multi results's split Character, if not set, all the results is in result[0]. script.runAsync() // or script.runAsync(asyncComlete: false) // the complete block call in global async // or script.runSync() // run in current thread- python 简单入门指北
- Python教程
- Running a Python Script from Swift

