Skip to content

Instantly share code, notes, and snippets.

@sturdysturge
Created October 19, 2022 00:31
Show Gist options
  • Select an option

  • Save sturdysturge/2f6a6c6646a7d08ccd32436a1e4285cb to your computer and use it in GitHub Desktop.

Select an option

Save sturdysturge/2f6a6c6646a7d08ccd32436a1e4285cb to your computer and use it in GitHub Desktop.
extension View {
// foregroundColor(_ colour: _ColorLiteralType) also works but Apple rejects
// undocumented types that start with an underscore from App Store approval
func foregroundColor(_ colour: UIColor) -> some View {
self.foregroundColor(Color(uiColor: colour))
}
}
struct ContentView: View {
var body: some View {
Text("Text")
.font(.largeTitle)
.foregroundColor(#colorLiteral(red: 1, green: 1, blue: 1, alpha: 1))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment