0
我遇到了一个存储“笔记”的问题。在swift中本地存储类对象3
这里是笔记类
class Note {
var title = ""
var content = ""
var color = UIColor()
}
,我得到的音符像这样
var notes: [Note] = []
香港专业教育学院增加了几个指出
let note1 = Note()
note1.title = "Houses"
note1.content = "A knowledgable and experienced staff ready to help you build the… "
note1.color = #colorLiteral(red: 0.515632689, green: 0.2357951403, blue: 0.9598689675, alpha: 1)
let note2 = Note()
note2.title = "Note"
note2.content = "A beautifully redesined note app"
note2.color = #colorLiteral(red: 0.8978558183, green: 0.7694990635, blue: 0.2824732065, alpha: 1)
let note3 = Note()
note3.title = "Note"
note3.content = "A beautifully redesined note app"
note3.color = #colorLiteral(red: 0.2296327353, green: 0.8767140508, blue: 0.5295107365, alpha: 1)
let note4 = Note()
note4.title = "Note"
note4.content = "A beautifully redesined note app"
note4.color = #colorLiteral(red: 0.8787152171, green: 0.4267094135, blue: 0.2448620498, alpha: 1)
notes.append(note1)
notes.append(note2)
notes.append(note3)
notes.append(note4)
,现在我需要保存它们,检索这些笔记,以便用户可以制作自己的笔记,并将其保存在本地设备上
感谢您的帮助:)
合作伙伴 – vadian
如果您是初学者,我现在只需将其保存在.plist文件中(它最终将成为XML)。请参阅:https://stackoverflow.com/questions/27197658/writing-swift-dictionary-to-file –
哦,我不是初学者我已经编写了3 - 4年,现在只是从来没有进入存储阵列我已经只存储整数和像userData那样的东西 –