0

I'm trying to globally change the UITextField color to white when my application loads.

I call my Theme manager like:

 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.
    let theme = ThemeManager.currentTheme()
    ThemeManager.applyTheme(theme: theme)
    
    return true
}

Then in my theme manager, I set the border color like:

        UITextField.appearance().layer.borderWidth = 5.0
        UITextField.appearance().layer.borderColor = UIColor.white.cgColor
        UITextField.appearance().textColor = UIColor.white

It seems like every other UI elment takes the changes fine, but this doesn't persist throughout the application. If I manually set the color on specific TextFields it works fine, but was trying to avoid that, am I doing something wrong?

Thanks.

  • Does this answer your question? [UITextField customization in AppDelegate not working for Swift](https://stackoverflow.com/questions/29861549/uitextfield-customization-in-appdelegate-not-working-for-swift) – Claudio Sep 24 '20 at 20:06
  • Yes and no. I guess I could make the custom class but would have to redo all that I have built already. So would take as much time as targeting them directly, but maybe it's what I'm going to have to do. – Justin Sinnard Sep 24 '20 at 20:25

0 Answers0