即時通訊製作測驗應用程序,我想從JSON文件中的服務器下載問題,解析它並製作問題對象,我將介紹它。我做到了,所以現在我想做出將創建JSON文件,並將其上傳到服務器上的應用程序,我想它看起來像這樣
以編程方式快速編寫JSON文件
我會從文本字段中的所有信息,並將其保存在這樣的JSON文件(與奧德值)
[
{
"question":"If you want to create a custom class which can be displayed on the view, you can subclass UIView.",
"answers":["True", "False"],
"correctIndex":0,
"module":3,
"lesson":0,
"feedback":"Subclassing UIView gives your class the methods and properties of a basic view which can be placed onto the view."
}
]
是在swift任何框架與我可以使用的功能? 或者我必須手動?如果手動如何保存JSON文件?
'JSONSerialization'數據! – luk2302
你應該看看SwiftyJSON(https://github.com/SwiftyJSON/SwiftyJSON) – mlidal
我認爲這可能會幫助你:[http://stackoverflow.com/questions/28768015/how-to-save-an-array- as-a-json-file-in-swift](http://stackoverflow.com/questions/28768015/how-to-save-an-array-as-a-json-file-in-swift) – chengsam