You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 14, 2021. It is now read-only.
I'm using SwiftGif to display animations along the UI, but with iOS 13 I found some of my animations are not displaying correctly on DarkMode, so I'd like to have trait variations as we have with UIColor:
I can make something similar with UIImage using this code (below), but I cannot get it to work with the Gifs.
extensionUIImage{
/// Creates a dynamic image that supports displaying a different image asset when dark mode is active.
staticfunc dynamicImageWith(
light makeLight:@autoclosure()->UIImage,
dark makeDark:@autoclosure()->UIImage)->UIImage{letimage=UITraitCollection(userInterfaceStyle:.light).makeImage(makeLight())
image.imageAsset?.register(makeDark(), with:UITraitCollection(userInterfaceStyle:.dark))return image
}}extensionUITraitCollection{
/// Creates the provided image with traits from the receiver.
func makeImage(_ makeImage:@autoclosure()->UIImage)->UIImage{varimage:UIImage!performAsCurrent{
image =makeImage()}return image
}}
changed the title [-]iOS 13 support for traitCollection.userInterfaceStyle[/-][+]iOS 13 support for traitCollection.userInterfaceStyle (Dark mode)[/+]on Nov 25, 2019
Activity
[-]iOS 13 support for traitCollection.userInterfaceStyle[/-][+]iOS 13 support for traitCollection.userInterfaceStyle (Dark mode)[/+]