Files
SwiftUI-LifeGame/macOS/View/PreferenceView.swift
T
2020-08-26 18:16:54 +09:00

44 lines
1.1 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//
// PreferenceView.swift
// LifeGameApp (macOS)
//
// Created by Yusuke Hosonuma on 2020/07/25.
//
import SwiftUI
private let CellSize: CGFloat = 20
struct PreferenceView: View {
@EnvironmentObject private var setting: SettingEnvironment
var body: some View {
VStack {
ColorPicker(selection: $setting.lightModeColor) {
HStack {
CellView(color: setting.lightModeColor, size: CellSize)
Text("Light mode")
}
}
// Note:
// フレームサイズで制限しないとすごくでかく表示される。(macOS-beta 5
.frame(width: 240, height: 40)
ColorPicker(selection: $setting.darkModeColor) {
HStack {
CellView(color: setting.darkModeColor, size: CellSize)
Text("Dark mode")
}
}
.frame(width: 240, height: 40)
}
.padding()
}
}
struct PreferenceView_Previews: PreviewProvider {
static var previews: some View {
PreferenceView()
}
}