placeholderText Color

Hi

Theres colors to use in SwiftUI when developing iOS App such as first line, but when I try to use the other system color placeholderText I get the error "Type Color? has no member placeholderText" why ?

Text("Hello, World!").foregroundColor(.quaternaryLabel)               
Answered by BabyJ in 717932022

If you want the placeholderText property for SwiftUI's Color, you can access it like this:

Color(uiColor: .placeholderText)

You can also wrap this inside of an extension on Color for simpler code.

quaternaryLabel is not defined in SwiftUI but UIKit.

Did you define yourself as an extension to Color ?

No, you mean I should import UIKit or what ? Didn’t get you ? But the quaternaryLabel works without any extension?

Accepted Answer

If you want the placeholderText property for SwiftUI's Color, you can access it like this:

Color(uiColor: .placeholderText)

You can also wrap this inside of an extension on Color for simpler code.

placeholderText Color
 
 
Q