Skip to content

Instantly share code, notes, and snippets.

@CPDigitalDarkroom
Created November 13, 2019 20:51
Show Gist options
  • Save CPDigitalDarkroom/d4acea0bffd1636c977e6b5b20681cf4 to your computer and use it in GitHub Desktop.
Save CPDigitalDarkroom/d4acea0bffd1636c977e6b5b20681cf4 to your computer and use it in GitHub Desktop.
Generate icon image on iOS 13
struct SBIconImageInfo {
struct CGSize size;
double scale;
double continuousCornerRadius;
};
- (UIImage *)iconImageForIdentifier:(NSString *)identifier {
SBIconController *iconController = [NSClassFromString(@"SBIconController") sharedInstance];
SBIcon *icon = [iconController.model expectedIconForDisplayIdentifier:identifier];
struct CGSize imageSize;
imageSize.height = 60;
imageSize.width = 60;
struct SBIconImageInfo imageInfo;
imageInfo.size = imageSize;
imageInfo.scale = [UIScreen mainScreen].scale;
imageInfo.continuousCornerRadius = 12;
return [icon generateIconImageWithInfo:imageInfo];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment