SwiftUI – How do I change the text color of a Textfield?

.foregroundColor actually does change the text color of TextField but only when it has a default value, for example this will work fine:

TextField(.constant("Hello World"), placeholder: Text("Type here..."))
  .foregroundColor(.green)

But once you remove the whole text, text field loses not only its color but the rest of its modifiers such as its alignment as well. This is likely a bug in the current version so I’ll file a bug report.


Update: This issue was fixed with Xcode 11 beta 3.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)