-
Notifications
You must be signed in to change notification settings - Fork 1
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
11 changed files
with
143 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// ColorScheme.swift | ||
// SNUTT | ||
// | ||
// Created by 박신홍 on 2022/12/14. | ||
// | ||
|
||
import SwiftUI | ||
|
||
extension ColorScheme { | ||
var description: String { | ||
switch self { | ||
case .dark: | ||
return "dark" | ||
case .light: | ||
return "light" | ||
@unknown default: | ||
return "light" | ||
} | ||
} | ||
|
||
static func from(description: String?) -> Self? { | ||
if description == "light" { | ||
return .light | ||
} | ||
|
||
if description == "dark" { | ||
return .dark | ||
} | ||
|
||
return nil | ||
} | ||
} |
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
34 changes: 34 additions & 0 deletions
34
SNUTT-2022/SNUTT/Views/Scenes/Settings/ColorSchemeSettingScene.swift
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,34 @@ | ||
// | ||
// ColorSchemeSettingScene.swift | ||
// SNUTT | ||
// | ||
// Created by 박신홍 on 2022/12/14. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct ColorSchemeSettingScene: View { | ||
@Binding var selection: ColorSchemeSelection | ||
|
||
var body: some View { | ||
List { | ||
ForEach(ColorSchemeSelection.allCases, id: \.self) { scheme in | ||
Button { | ||
withAnimation { | ||
selection = scheme | ||
} | ||
} label: { | ||
HStack { | ||
Text(scheme.rawValue) | ||
Spacer() | ||
if selection == scheme { | ||
Image(systemName: "checkmark") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
.listStyle(.insetGrouped) | ||
.navigationTitle("색상 모드") | ||
} | ||
} |
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