Merge commit '7621e2f8dec938cf48181c8b10afc9b01f444e68' into beta

This commit is contained in:
Ilya Laktyushin
2025-12-06 02:17:48 +04:00
commit 8344b97e03
28070 changed files with 7995182 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
objc_library(
name = "AppBundle",
module_name = "AppBundle",
enable_modules = True,
srcs = glob([
"Sources/**/*.m",
"Sources/**/*.h",
], allow_empty=True),
hdrs = glob([
"PublicHeaders/**/*.h",
]),
includes = [
"PublicHeaders",
],
sdk_frameworks = [
"Foundation",
"UIKit",
],
visibility = [
"//visibility:public",
],
)
@@ -0,0 +1,10 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NSBundle * _Nonnull getAppBundle(void);
@interface UIImage (AppBundle)
- (instancetype _Nullable)initWithBundleImageName:(NSString * _Nonnull)bundleImageName;
@end
@@ -0,0 +1,27 @@
#import <AppBundle/AppBundle.h>
NSBundle * _Nonnull getAppBundle() {
static NSBundle *appBundle = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSBundle *bundle = [NSBundle mainBundle];
if ([[bundle.bundleURL pathExtension] isEqualToString:@"appex"]) {
bundle = [NSBundle bundleWithURL:[[bundle.bundleURL URLByDeletingLastPathComponent] URLByDeletingLastPathComponent]];
} else if ([[bundle.bundleURL pathExtension] isEqualToString:@"framework"]) {
bundle = [NSBundle bundleWithURL:[[bundle.bundleURL URLByDeletingLastPathComponent] URLByDeletingLastPathComponent]];
} else if ([[bundle.bundleURL pathExtension] isEqualToString:@"Frameworks"]) {
bundle = [NSBundle bundleWithURL:[bundle.bundleURL URLByDeletingLastPathComponent]];
}
appBundle = bundle;
});
return appBundle;
}
@implementation UIImage (AppBundle)
- (instancetype _Nullable)initWithBundleImageName:(NSString * _Nonnull)bundleImageName {
return [UIImage imageNamed:bundleImageName inBundle:getAppBundle() compatibleWithTraitCollection:nil];
}
@end