Skip to content

Commit 8c86e61

Browse files
committed
Update new UIView & CALayer private API
1 parent 8733b52 commit 8c86e61

File tree

5 files changed

+31
-6
lines changed

5 files changed

+31
-6
lines changed

Sources/OpenSwiftUI/Integration/Render/UIKit/UIViewPlatformViewDefinition.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,18 @@ final class UIViewPlatformViewDefinition: PlatformViewDefinition, @unchecked Sen
5252
if kind != .platformView && kind != .platformGroup {
5353
view.autoresizesSubviews = false
5454
if !kind.isContainer {
55-
// view._setFocusInteractionEnabled = false
55+
view._setFocusInteractionEnabled(false)
5656
}
5757
}
5858
view.layer.anchorPoint = .zero
5959
switch kind {
6060
case .color, .image, .shape:
61-
// view.layer.setAllowsEdgeAntialiasing = true
61+
view.layer.setAllowsEdgeAntialiasing(true)
6262
break
6363
case .geometry, .projection, .affine3D, .mask, .platformEffect:
64-
// view.layer.setAllowsGroupOpacity = false
65-
// view.layer.setAllowsGroupBlending = false
64+
let layer = view.layer
65+
layer.setAllowsGroupOpacity(false)
66+
layer.setAllowsGroupBlending(false)
6667
break
6768
default:
6869
break

Sources/OpenSwiftUI_SPI/Shims/CoreAnimation/CoreAnimation_Private.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ OPENSWIFTUI_ASSUME_NONNULL_BEGIN
1515

1616
@interface CALayer (OpenSwiftUI_SPI)
1717
@property (nonatomic, assign, readonly) BOOL hasBeenCommitted_openswiftui_safe_wrapper OPENSWIFTUI_SWIFT_NAME(hasBeenCommitted);
18+
- (void)setAllowsEdgeAntialiasing_openswiftui_safe_wrapper:(BOOL)allows OPENSWIFTUI_SWIFT_NAME(setAllowsEdgeAntialiasing(_:));
19+
- (void)setAllowsGroupOpacity_openswiftui_safe_wrapper:(BOOL)allows OPENSWIFTUI_SWIFT_NAME(setAllowsGroupOpacity(_:));
20+
- (void)setAllowsGroupBlending_openswiftui_safe_wrapper:(BOOL)allows OPENSWIFTUI_SWIFT_NAME(setAllowsGroupBlending(_:));
1821

1922
@property (nonatomic, assign) uint64_t openSwiftUI_viewTestProperties;
2023
@end

Sources/OpenSwiftUI_SPI/Shims/CoreAnimation/CoreAnimation_Private.m

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,34 @@
33
// OpenSwiftUI_SPI
44

55
#import "CoreAnimation_Private.h"
6-
#import "../OpenSwiftUIShims.h"
76

87
#if __has_include(<QuartzCore/CoreAnimation.h>)
98

9+
#import "../OpenSwiftUIShims.h"
1010
#import <objc/runtime.h>
1111

1212
@implementation CALayer (OpenSwiftUI_SPI)
1313

1414
- (BOOL)hasBeenCommitted_openswiftui_safe_wrapper {
15-
OPENSWIFTUI_SAFE_WRAPPER_IMP(BOOL, @"_performBlockAfterCATransactionCommits:", NO);
15+
OPENSWIFTUI_SAFE_WRAPPER_IMP(BOOL, @"hasBeenCommitted", NO);
1616
return func(self, selector);
1717
}
1818

19+
- (void)setAllowsEdgeAntialiasing_openswiftui_safe_wrapper:(BOOL)allows {
20+
OPENSWIFTUI_SAFE_WRAPPER_IMP(void, @"setAllowsEdgeAntialiasing:", , BOOL);
21+
func(self, selector, allows);
22+
}
23+
24+
- (void)setAllowsGroupOpacity_openswiftui_safe_wrapper:(BOOL)allows {
25+
OPENSWIFTUI_SAFE_WRAPPER_IMP(void, @"setAllowsGroupOpacity:", , BOOL);
26+
func(self, selector, allows);
27+
}
28+
29+
- (void)setAllowsGroupBlending_openswiftui_safe_wrapper:(BOOL)allows {
30+
OPENSWIFTUI_SAFE_WRAPPER_IMP(void, @"setAllowsGroupBlending:", , BOOL);
31+
func(self, selector, allows);
32+
}
33+
1934
- (uint64_t)openSwiftUI_viewTestProperties {
2035
NSNumber *properties = [self valueForKey:@"_viewTestProperties"];
2136
return properties.integerValue;

Sources/OpenSwiftUI_SPI/Shims/UIKit/UIKit_Private.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ OPENSWIFTUI_ASSUME_NONNULL_BEGIN
2727

2828
@interface UIView (OpenSwiftUI_SPI)
2929
- (BOOL)_shouldAnimatePropertyWithKey_openswiftui_safe_wrapper:(NSString *)key OPENSWIFTUI_SWIFT_NAME(_shouldAnimateProperty(withKey:));
30+
- (void)_setFocusInteractionEnabled_openswiftui_safe_wrapper:(BOOL)enabled OPENSWIFTUI_SWIFT_NAME(_setFocusInteractionEnabled(_:));
3031
@end
3132

3233
@interface UIViewController (OpenSwiftUI_SPI)

Sources/OpenSwiftUI_SPI/Shims/UIKit/UIKit_Private.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ - (BOOL)_shouldAnimatePropertyWithKey_openswiftui_safe_wrapper:(NSString *)key {
4343
OPENSWIFTUI_SAFE_WRAPPER_IMP(BOOL, @"_shouldAnimatePropertyWithKey:", NO, NSString *);
4444
return func(self, selector, key);
4545
}
46+
47+
- (void)_setFocusInteractionEnabled_openswiftui_safe_wrapper:(BOOL)enabled {
48+
OPENSWIFTUI_SAFE_WRAPPER_IMP(void, @"_setFocusInteractionEnabled:", , BOOL);
49+
func(self, selector, enabled);
50+
}
4651
@end
4752

4853
@implementation UIViewController (OpenSwiftUI_SPI)

0 commit comments

Comments
 (0)