美文网首页
Swiftui ColorSet 设置颜色

Swiftui ColorSet 设置颜色

作者: 码代码的李二狗 | 来源:发表于2021-10-18 13:29 被阅读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)
    }
}

相关文章

网友评论

      本文标题:Swiftui ColorSet 设置颜色

      本文链接:https://www.haomeiwen.com/subject/nkcnoltx.html