Skip to content

Commit 95c081b

Browse files
committed
Update UIKit_Private
1 parent b189546 commit 95c081b

File tree

2 files changed

+91
-6
lines changed

2 files changed

+91
-6
lines changed

Sources/OpenSwiftUI_SPI/Shims/UIKit/UIKit_Private.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ OPENSWIFTUI_ASSUME_NONNULL_BEGIN
1717

1818
@interface UIApplication (OpenSwiftUI_SPI)
1919
// Test API
20-
- (void)startedTest:(nullable NSString *)name;
21-
- (void)finishedTest:(nullable NSString *)name;
22-
- (void)failedTest:(nullable NSString *)name withFailure:(nullable NSError*)failure;
23-
- (nullable NSString *)_launchTestName;
20+
- (void)startedTest_openswiftui_safe_wrapper:(nullable NSString *)name OPENSWIFTUI_SWIFT_NAME(startedTest(_:));
21+
- (void)finishedTest_openswiftui_safe_wrapper:(nullable NSString *)name OPENSWIFTUI_SWIFT_NAME(finishedTest(_:));
22+
- (void)failedTest_openswiftui_safe_wrapper:(nullable NSString *)name withFailure:(nullable NSError*)failure OPENSWIFTUI_SWIFT_NAME(failedTest(_:withFailure:));
23+
- (nullable NSString *)_launchTestName_openswiftui_safe_wrapper OPENSWIFTUI_SWIFT_NAME(_launchTestName());
2424

2525
- (void)_performBlockAfterCATransactionCommits_openswiftui_safe_wrapper:(void (^)(void))block OPENSWIFTUI_SWIFT_NAME(_performBlockAfterCATransactionCommits(_:));
2626
@end
2727

2828
@interface UIView (OpenSwiftUI_SPI)
29-
- (BOOL)_shouldAnimatePropertyWithKey:(NSString *)key;
29+
- (BOOL)_shouldAnimatePropertyWithKey_openswiftui_safe_wrapper:(NSString *)key OPENSWIFTUI_SWIFT_NAME(_shouldAnimateProperty(withKey:));
3030
@end
3131

3232
@interface UIViewController (OpenSwiftUI_SPI)
33-
@property (nonatomic, readonly) BOOL _canShowWhileLocked;
33+
@property (nonatomic, readonly) BOOL _canShowWhileLocked_openswiftui_safe_wrapper OPENSWIFTUI_SWIFT_NAME(_canShowWhileLocked);
3434
@end
3535

3636
OPENSWIFTUI_EXPORT

Sources/OpenSwiftUI_SPI/Shims/UIKit/UIKit_Private.m

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,91 @@ - (void)_performBlockAfterCATransactionCommits_openswiftui_safe_wrapper:(void (^
2323
func(self, selector, block);
2424
}
2525
}
26+
27+
- (void)startedTest_openswiftui_safe_wrapper:(NSString *)name {
28+
typedef void (*Func)(UIApplication *, SEL, NSString *);
29+
SEL selector = NSSelectorFromString(@"startedTest:");
30+
Func func = nil;
31+
if ([self respondsToSelector:selector]) {
32+
IMP impl = class_getMethodImplementation([self class], selector);
33+
func = (Func)impl;
34+
}
35+
if (func != nil) {
36+
func(self, selector, name);
37+
}
38+
}
39+
40+
- (void)finishedTest_openswiftui_safe_wrapper:(NSString *)name {
41+
typedef void (*Func)(UIApplication *, SEL, NSString *);
42+
SEL selector = NSSelectorFromString(@"finishedTest:");
43+
Func func = nil;
44+
if ([self respondsToSelector:selector]) {
45+
IMP impl = class_getMethodImplementation([self class], selector);
46+
func = (Func)impl;
47+
}
48+
if (func != nil) {
49+
func(self, selector, name);
50+
}
51+
}
52+
53+
- (void)failedTest_openswiftui_safe_wrapper:(NSString *)name withFailure:(NSError *)failure {
54+
typedef void (*Func)(UIApplication *, SEL, NSString *, NSError *);
55+
SEL selector = NSSelectorFromString(@"failedTest:withFailure:");
56+
Func func = nil;
57+
if ([self respondsToSelector:selector]) {
58+
IMP impl = class_getMethodImplementation([self class], selector);
59+
func = (Func)impl;
60+
}
61+
if (func != nil) {
62+
func(self, selector, name, failure);
63+
}
64+
}
65+
66+
- (NSString *)_launchTestName_openswiftui_safe_wrapper {
67+
typedef NSString* (*Func)(UIApplication *, SEL);
68+
SEL selector = NSSelectorFromString(@"_launchTestName");
69+
Func func = nil;
70+
if ([self respondsToSelector:selector]) {
71+
IMP impl = class_getMethodImplementation([self class], selector);
72+
func = (Func)impl;
73+
}
74+
if (func != nil) {
75+
return func(self, selector);
76+
}
77+
return nil;
78+
}
79+
@end
80+
81+
@implementation UIView (OpenSwiftUI_SPI)
82+
- (BOOL)_shouldAnimatePropertyWithKey_openswiftui_safe_wrapper:(NSString *)key {
83+
typedef BOOL (*Func)(UIView *, SEL, NSString *);
84+
SEL selector = NSSelectorFromString(@"_shouldAnimatePropertyWithKey:");
85+
Func func = nil;
86+
if ([self respondsToSelector:selector]) {
87+
IMP impl = class_getMethodImplementation([self class], selector);
88+
func = (Func)impl;
89+
}
90+
if (func != nil) {
91+
return func(self, selector, key);
92+
}
93+
return NO;
94+
}
95+
@end
96+
97+
@implementation UIViewController (OpenSwiftUI_SPI)
98+
- (BOOL)_canShowWhileLocked_openswiftui_safe_wrapper {
99+
typedef BOOL (*Func)(UIViewController *, SEL);
100+
SEL selector = NSSelectorFromString(@"_canShowWhileLocked");
101+
Func func = nil;
102+
if ([self respondsToSelector:selector]) {
103+
IMP impl = class_getMethodImplementation([self class], selector);
104+
func = (Func)impl;
105+
}
106+
if (func != nil) {
107+
return func(self, selector);
108+
}
109+
return NO;
110+
}
26111
@end
27112

28113
#endif /* UIKit.h */

0 commit comments

Comments
 (0)