Created
July 28, 2020 11:43
-
-
Save oocoocococo/a83c27b0040927bd3f686cba8b8bac21 to your computer and use it in GitHub Desktop.
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
import SwiftUI | |
struct ContentView: View { | |
/// スイッチのオンオフ | |
@State var isOn: Bool = false | |
/// 選択した日付 | |
@State var selection: Date = Date() | |
var body: some View { | |
NavigationView { | |
Form { | |
Toggle(isOn: $isOn) { | |
Text("リマインダー") | |
} | |
// スイッチがオンの時に表示する | |
if isOn { | |
DatePicker(selection: $selection, | |
displayedComponents: .hourAndMinute) { | |
Text("通知する時間") | |
} | |
} | |
Button(action: { }) { | |
Text("リセット") | |
} | |
} | |
.navigationBarTitle("設定", displayMode: .inline) | |
.listStyle(GroupedListStyle()) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment