Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions DevLog/Storage/Persistence/UserDefaultsStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ final class UserDefaultsStore {

func removeAll() {
guard let bundleIdentifier = Bundle.main.bundleIdentifier else { return }
let firstLaunch = userDefaults.object(forKey: "isFirstLaunch")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

하드코딩된 문자열 "isFirstLaunch"를 사용하는 것보다, 재사용성과 유지보수성을 높이기 위해 이 키를 상수로 정의하는 것이 좋습니다. 예를 들어, private enum Keys { static let isFirstLaunch = "isFirstLaunch" } 와 같이 클래스 내에 정의하고 Keys.isFirstLaunch로 참조할 수 있습니다.

userDefaults.removePersistentDomain(forName: bundleIdentifier)
if let value = firstLaunch as? Bool {
userDefaults.set(value, forKey: "isFirstLaunch")
}
}
}