Skip to content

Instantly share code, notes, and snippets.

@oocoocococo
Last active January 23, 2021 00:50
Show Gist options
  • Save oocoocococo/8c2596bef219f474b11258ffc271225b to your computer and use it in GitHub Desktop.
Save oocoocococo/8c2596bef219f474b11258ffc271225b to your computer and use it in GitHub Desktop.
import SwiftUI
struct ContentView: View {
var body: some View {
TabView {
VStack {
Text("Assets.xcassetsでAccentColorに赤を指定")
.padding()
Button("ボタン(色指定なし)", action: {})
.padding()
Button("ボタン(accentColorを上書き)", action: {})
.padding()
.accentColor(.purple) // accentColorを上書き
Toggle(isOn: .constant(true), label: {
Text("スイッチ (色指定なし)")
})
.padding()
Toggle(isOn: .constant(true), label: {
Text("スイッチ (accentColorを指定)")
})
.padding()
.toggleStyle(SwitchToggleStyle(tint: .accentColor)) // ToggleにaccentColorを指定
}
.tabItem {
Image(systemName: "circle.fill")
Text("丸")
}
Text("三角のビュー")
.tabItem {
Image(systemName: "triangle.fill")
Text("三角")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment