getsling / GVUserDefaults

NSUserDefaults access via properties.
MIT License
952 stars 92 forks source link

[Enhancement] for now, GVUserDefaults could save custom object directly! #35

Open MrPans opened 7 years ago

MrPans commented 7 years ago

extend the persistent types to any object which conform NSCoding protocol.

MrPans commented 6 years ago

NSUserDefault的文档中说明了,所有存进去的对象都是immutable的。这就意味着,直接取出修改对象内的是无效的。需要修改后再次把整个对象 set 一次才会生效。

另外存储是持久化在硬盘里,修改对象内的属性是修改内存中数据,是不会同步的。

在 2017年11月5日,18:48,wonin notifications@github.com 写道:

@wonin commented on this pull request.

你好,我测试修改对象属性无效。

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

MrPans commented 6 years ago

还有,想要存储的对象需要满足 NSCoding 协议