Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UserDefault kvc #24

Open
Winter-J-27 opened this issue May 15, 2024 · 2 comments
Open

UserDefault kvc #24

Winter-J-27 opened this issue May 15, 2024 · 2 comments

Comments

@Winter-J-27
Copy link

UserDefault 包装器是用 setValue,这是 KVC 的方法,用 set(value: forKey:) 比较好?

@Lakr233
Copy link
Owner

Lakr233 commented May 17, 2024

不是特别清楚你说的是什么 不过应该区别不大吧

@Winter-J-27
Copy link
Author

storage.setValue(defaultValue, forKey: key)

这个不是 UserDefaults 的 API

下面这个才是

storage.set(defaultValue, forKey: key)

在某些场景使用 KVC 的会有问题吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants