you can use this model to make the encoding & decoding much easier. more detail in the Demo.swift
First Step 使用字典初始化,并归档
let he = Hello.init(dic: ["name": 123,
"gender":true])
let demo = Demo.init(dic: ["content":content.text ?? "nil",
"age":12,
"name":"BBH",
"gender":false,
"classMates":["RQQ","DZ"],
"otherDic":["hello":"world"],
"hellocontent":he,
"intArr":[2,3,4,5]
])
demo.archive(fileName: "helloFileName")
Seconde Step 解档并获取对象描述
let demo = Demo.unarchive(fileName: "helloFileName") as? Demo
output.text = demo?.content
print(demo?.description ?? "nil")