-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
345 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// Persistence.swift | ||
// RespectU | ||
// | ||
// Created by Presto on 13/03/2019. | ||
// Copyright © 2019 Presto. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
struct Persistence { | ||
|
||
static var favoriteButton: Button { | ||
get { | ||
let buttonString = UserDefaults.standard.string(forKey: "favoriteButton") ?? "" | ||
return Button(rawValue: buttonString) ?? .button4 | ||
} | ||
set { | ||
UserDefaults.standard.do { | ||
$0.set(newValue.rawValue, forKey: "favoriteButton") | ||
$0.synchronize() | ||
} | ||
} | ||
} | ||
|
||
static var nickname: String { | ||
get { | ||
return UserDefaults.standard.string(forKey: "nickname") ?? L10n.nicknameSetting | ||
} | ||
set { | ||
UserDefaults.standard.do { | ||
$0.set(newValue, forKey: "nickname") | ||
$0.synchronize() | ||
} | ||
} | ||
} | ||
|
||
static var numberOfLaunching: Int { | ||
get { | ||
return UserDefaults.standard.integer(forKey: "appOpenCount") | ||
} | ||
set { | ||
UserDefaults.standard.do { | ||
$0.set(newValue, forKey: "appOpenCount") | ||
$0.synchronize() | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.