microsoft / FluentDarkModeKit

A library for backporting Dark Mode in iOS
MIT License
1.63k stars 125 forks source link

Fix crash for CGColor related property on view called with color with `withAlphaComponent` #96

Closed levinli303 closed 4 years ago

levinli303 commented 4 years ago

When setting a view's background color with withAlphaComponent with an alpha value other than 0.5, for example view.backgroundColor = UIColor(.dm, light: .white, dark: .black).withAlphaComponent(0.4), it would crash with:

image

it's weird that it would not crash with view.backgroundColor = UIColor(.dm, light: .white, dark: .black).withAlphaComponent(0.5) though

To solve this, we bridge CGColor call directly, instead of relying on message forwarding

levinli303 commented 4 years ago

@imWildCat this should solve the crash we encountered