我正在尝试通过在烟雾中使用免费的标记模板来将JSON文件转换为CSV来读取JSON文件,但无法读取多个订单项。
有人可以为我提供用于在单个订单项和多个订单项的自由标记中读取json的确切语法吗?请参阅附件的输入文件。
let colorToSetAsDefault : UIColor = view.backgroundColor!
do
{
let data : NSData = try NSKeyedArchiver.archivedData(withRootObject: colorToSetAsDefault,requiringSecureCoding: false) as NSData
UserDefaults.standard.set(data, forKey: "userHeadingColor") // your key in quotes
UserDefaults.standard.synchronize()
} // end of do
catch
{
print("Couldn't save color")
} // end of catch
// load the color back as a test to make sure the save has worked
if let colorObject = UserDefaults.standard.object(forKey: "userHeadingColor")
{
let colorData = colorObject as! NSData
let color = NSKeyedUnarchiver.unarchiveObject(with: colorData as Data) as? UIColor
// replace with unarchivedObjectOfClass:fromData:error:
self.testDefaultsView.backgroundColor = color
}
else
{
}
预先感谢, 库玛。