Fix compiling on visionOS

This commit is contained in:
Shadowfacts 2025-03-03 20:58:56 -05:00
parent 874d2588f8
commit 883f9a3cb2
2 changed files with 4 additions and 2 deletions

View File

@ -11,7 +11,6 @@
NS_ASSUME_NONNULL_BEGIN
#if !TARGET_OS_VISION
@interface Swizzler : NSObject
+ (BOOL)swizzleStatusBarManagerWithExceptionHandler:(void (^)(NSException *))captureException;
@ -37,6 +36,5 @@ NS_SWIFT_UI_ACTOR
- (void)handleTapAction:(id)sender;
@end
#endif
NS_ASSUME_NONNULL_END

View File

@ -12,6 +12,7 @@
@implementation Swizzler
+ (BOOL)swizzleStatusBarManagerWithExceptionHandler:(void (^)(NSException *))captureException {
#if !TARGET_OS_VISION
__block IMP original;
IMP new = imp_implementationWithBlock(^void (UIStatusBarManager *self, id sender) {
if ([self.windowScene.delegate conformsToProtocol:@protocol(StatusBarTapHandling)]) {
@ -32,6 +33,9 @@
});
original = class_replaceMethod(UIStatusBarManager.class, @selector(handleTapAction:), new, "v@:@");
return original != nil;
#else
return YES;
#endif
}
@end