Swiftui ColorSet 设置颜色

2021-10-18  本文已影响0人  码代码的李二狗

通过colorset设置颜色使app颜色设置更加直观,你可以在assets设置颜色图片,并加载它们

image.png
extension Color{
    public static var steam_white: Color {
        Color("steam_white", bundle: nil)
    }
}

然后你可以通过Color的extension来加载颜色

struct IconThemeView: View {
    var body: some View {
        NavigationView{
            List(0..<5){_ in
                ExtractedView().ignoresSafeArea()
            }.navigationBarTitle("Featue", displayMode: .large)
            .navigationBarBackButtonHidden(true)
        }.background(Color.steam_theme)
    }
}

上一篇 下一篇

猜你喜欢

热点阅读