例如我只想这个样本数组转换成JSON对象使用未解决的标识符“JSONEncoder” swift4
var test = [String : Any]()
test["title"] = "title"
test["description"] = "description"
test["date"] = Date.init()
,我得到这个错误:
use of unresolved identifier 'JSONEncoder'
print(JSONEncoder (test))
您是否进口基金会?你确定你正在运行Swift 4吗?什么是“swift -version”输出? – Hamish