Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
Use imageWithConfiguration: on iOS 13+
Browse files Browse the repository at this point in the history
  • Loading branch information
levinli303 committed Jul 20, 2020
1 parent 9a0cce8 commit a18e76e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Sources/DarkModeCore/DMDynamicImage.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ - (instancetype)initWithLightImage:(UIImage *)lightImage darkImage:(UIImage *)da
- (UIImage *)resolvedImage {
if (DMTraitCollection.overrideTraitCollection.userInterfaceStyle == DMUserInterfaceStyleDark) {
return self.darkImage;
} else {
return self.lightImage;
}
return self.lightImage;
}

- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel {
Expand Down Expand Up @@ -88,6 +87,13 @@ - (UIImage *)imageWithHorizontallyFlippedOrientation {
darkImage:[self.darkImage imageWithHorizontallyFlippedOrientation]];
}

- (UIImage *)imageWithConfiguration:(UIImageConfiguration *)configuration API_AVAILABLE(ios(13.0)) {
if (configuration.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
return [_darkImage imageWithConfiguration:configuration];
}
return [_lightImage imageWithConfiguration:configuration];
}

- (id)copy {
return [self copyWithZone:nil];
}
Expand Down

0 comments on commit a18e76e

Please sign in to comment.