SwiftUIの基本を身につけたい方はこちら

【SwiftUI】カラーピッカーを作る方法

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
struct ContentView: View {
@State var selectedColor = Color.red
var body: some View {
ColorPicker("色を修正", selection: $selectedColor)
.padding()
}
}
struct ContentView: View { @State var selectedColor = Color.red var body: some View { ColorPicker("色を修正", selection: $selectedColor) .padding() } }
struct ContentView: View {
    @State var selectedColor = Color.red
    
    var body: some View {
        ColorPicker("色を修正", selection: $selectedColor)
            .padding()
    }
}

評価