My code.swift is below :
我的code.swift如下:
public class Test {
var testA: String = ""
var testB: String = ""
let T_testA : String = "testA"
let T_testB : String = "testB"
init(testA: String, testB: String) {
self.testA = testA
self.testB = testB
}
func toString() -> String? {
let jsonDic : [String: AnyObject] = [
T_testA: testA,
T_testB: testB,
]
do {
let jsonObject = try NSJSONSerialization.dataWithJSONObject( jsonDic, options: NSJSONWritingOptions.PrettyPrinted)
return String(data: jsonObject, encoding: NSUTF8StringEncoding)
} catch {
return nil
}
}
}
p