Skip to content

Conversation

AngeloStavrow
Copy link
Collaborator

Closes #10.

This PR adds a colorSchemeIntegerKey key to UserDefaults for an integer value. When PreferencesModel's appearance property is set, the new value is stored in UserDefaults.

On launch, the WriteFreelyModel sets the PreferenceModel's appearance property to the value saved in UserDefaults. As this forces an update to the UI, we make sure it happens on the main thread, or else this gets called before the UIWindow has been created on iOS.

This persists the user's preference for colour scheme between app launches.

@AngeloStavrow AngeloStavrow added this to the 1.0.0-beta milestone Aug 25, 2020
@AngeloStavrow AngeloStavrow requested a review from thebaer August 25, 2020 13:07
@AngeloStavrow AngeloStavrow self-assigned this Aug 25, 2020
@AngeloStavrow AngeloStavrow merged commit 4097fc0 into main Aug 27, 2020
@AngeloStavrow AngeloStavrow deleted the persist-prefs-in-userdefaults branch August 27, 2020 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Preferences are not remembered between app launches
2 participants