London Escorts sunderland escorts 1v1.lol unblocked yohoho 76 https://www.symbaloo.com/mix/yohoho?lang=EN yohoho https://www.symbaloo.com/mix/agariounblockedpvp https://yohoho-io.app/ https://www.symbaloo.com/mix/agariounblockedschool1?lang=EN
2 C
New York
Wednesday, January 29, 2025

ios – CGColor doesn’t behave accurately in darkish mode when utilized in dispatch queue


I’ve a dynamic coloration (let myColor = UIColor.label) which is designed to seem in another way in gentle and darkish modes.

After I programmatically set darkish theme, after which inquire a coloration’s cgColor parts, it experiences [1.0, 1.0]. It’s right, as a result of in darkish mode textual content coloration is predicted to be white.

Nevertheless, once I test it from inside dispatch queue, it experiences [0.0, 1.0], as if in gentle theme.

It is a minimal reproducing pattern:

class ViewController: UIViewController {
    let myColor: UIColor = .label
    
    override func viewDidLoad() {
        tremendous.viewDidLoad()
        
        UIApplication.shared.home windows.forEach {
            $0.overrideUserInterfaceStyle = .darkish
        }
        if let coloration = myColor.cgColor.parts {
            print("initially (coloration)")
            DispatchQueue.major.async {
                if let coloration = self.myColor.cgColor.parts {
                    print("in queue (coloration)")
                }
            }
        }
    }
}

Output:

initially [1.0, 1.0]
in queue [0.0, 1.0]

Any ideas why it occurs and methods to repair it?

Related Articles

Social Media Auto Publish Powered By : XYZScripts.com