mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 21:45:19 +00:00
20 lines
748 B
Objective-C
20 lines
748 B
Objective-C
#import "AppBundle.h"
|
|
|
|
NSBundle * _Nonnull getAppBundle() {
|
|
NSBundle *bundle = [NSBundle mainBundle];
|
|
if ([[bundle.bundleURL pathExtension] isEqualToString:@"appex"]) {
|
|
bundle = [NSBundle bundleWithURL:[[bundle.bundleURL URLByDeletingLastPathComponent] URLByDeletingLastPathComponent]];
|
|
} else if ([[bundle.bundleURL pathExtension] isEqualToString:@"Frameworks"]) {
|
|
bundle = [NSBundle bundleWithURL:[bundle.bundleURL URLByDeletingLastPathComponent]];
|
|
}
|
|
return bundle;
|
|
}
|
|
|
|
@implementation UIImage (AppBundle)
|
|
|
|
- (instancetype _Nullable)initWithBundleImageName:(NSString * _Nonnull)bundleImageName {
|
|
return [UIImage imageNamed:bundleImageName inBundle:getAppBundle() compatibleWithTraitCollection:nil];
|
|
}
|
|
|
|
@end
|