Skip to content

Commit 06a459b

Browse files
authored
Update Private API for CoreAnimation (#286)
1 parent 3e8a4f4 commit 06a459b

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ final class UIViewPlatformViewDefinition: PlatformViewDefinition, @unchecked Sen
4343
view.layer.anchorPoint = .zero
4444
switch kind {
4545
case .color, .image, .shape:
46-
view.layer.setAllowsEdgeAntialiasing(true)
46+
view.layer.allowsEdgeAntialiasing = true
4747
break
4848
case .geometry, .projection, .affine3D, .mask, .platformEffect:
4949
let layer = view.layer
50-
layer.setAllowsGroupOpacity(false)
51-
layer.setAllowsGroupBlending(false)
50+
layer.allowsGroupOpacity = false
51+
layer.allowsGroupBlending = false
5252
break
5353
default:
5454
break

Sources/OpenSwiftUI_SPI/Shims/CoreAnimation/CoreAnimation_Private.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ 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(_:));
18+
@property (nonatomic, assign) BOOL allowsGroupBlending_openswiftui_safe_wrapper OPENSWIFTUI_SWIFT_NAME(allowsGroupBlending);
2119

2220
@property (nonatomic, assign) uint64_t openSwiftUI_viewTestProperties;
2321
@end

Sources/OpenSwiftUI_SPI/Shims/CoreAnimation/CoreAnimation_Private.m

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,9 @@ - (BOOL)hasBeenCommitted_openswiftui_safe_wrapper {
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);
19+
- (BOOL)allowsGroupBlending_openswiftui_safe_wrapper {
20+
OPENSWIFTUI_SAFE_WRAPPER_IMP(BOOL, @"allowsGroupBlending", NO);
21+
return func(self, selector);
2722
}
2823

2924
- (void)setAllowsGroupBlending_openswiftui_safe_wrapper:(BOOL)allows {

Tests/OpenSwiftUI_SPITests/Shims/CoreAnimationPrivateTests.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@ struct CoreAnimationPrivateTests {
1212
func layer() {
1313
let layer = CALayer()
1414
#expect(layer.hasBeenCommitted == false)
15-
layer.setAllowsEdgeAntialiasing(true)
16-
layer.setAllowsGroupOpacity(true)
17-
layer.setAllowsGroupBlending(true)
18-
15+
16+
#expect(layer.allowsGroupBlending == true)
17+
layer.allowsGroupBlending = false
18+
#expect(layer.allowsGroupBlending == false)
19+
layer.allowsGroupBlending = true
20+
#expect(layer.allowsGroupBlending == true)
21+
22+
#expect(layer.openSwiftUI_viewTestProperties == 0)
1923
layer.openSwiftUI_viewTestProperties = 42
2024
#expect(layer.openSwiftUI_viewTestProperties == 42)
2125
}

0 commit comments

Comments
 (0)