SwiftUI 2.0 中的accentColor
2021-02-12 本文已影响0人
刘铁崧
效果:


代码
struct ContentView: View {
var body: some View{
NavigationView{
VStack{
Button("测试"){}
Text("swiftUI 2.0")
.foregroundColor(.accentColor)
Slider(value: .constant(0.5))
}
}
}
}
Assets.xcassets中设置AccentColor

注:一些组件不设置默认的AccentColor可以自行添加实现效果