|
1 | 1 | #if !os(watchOS)
|
2 |
| -import SwiftUI |
3 | 2 |
|
4 | 3 | #if os(macOS)
|
5 | 4 | import AppKit
|
@@ -32,13 +31,9 @@ import AppKit
|
32 | 31 | /// - note: Check out ``PlatformWindowScene`` for details on how this behaves in AppKit.
|
33 | 32 | open var hostingWindowScene: PlatformWindowScene? { window?.screen }
|
34 | 33 |
|
35 |
| - open override func layout() { |
36 |
| - layoutSubviews() |
37 |
| - } |
38 |
| - |
39 | 34 | /// This offers a place to override `layoutSubviews` for both UIKit and AppKit, since the method name on `NSView` is just `layout`.
|
40 | 35 | open func layoutSubviews() {
|
41 |
| - super.layout() |
| 36 | + layout() |
42 | 37 | }
|
43 | 38 |
|
44 | 39 | /// This offers a place to override `didMoveToSuperview` for both UIKit and AppKit, since the method name on `NSView` is different.
|
@@ -81,48 +76,3 @@ import UIKit
|
81 | 76 | #endif // os(macOS)
|
82 | 77 |
|
83 | 78 | #endif // !os(watchOS)
|
84 |
| - |
85 |
| -#if DEBUG |
86 |
| -private final class TestView: PlatformView { |
87 |
| - override func layoutSubviews() { |
88 |
| - super.layoutSubviews() |
89 |
| - |
90 |
| - let testLayer: CALayer |
91 |
| - |
92 |
| - if let layer = platformLayer.sublayers?.first { |
93 |
| - testLayer = layer |
94 |
| - } else { |
95 |
| - testLayer = CALayer() |
96 |
| - testLayer.backgroundColor = PlatformColor.systemGreen.cgColor |
97 |
| - platformLayer.addSublayer(testLayer) |
98 |
| - } |
99 |
| - |
100 |
| - |
101 |
| - CATransaction.begin() |
102 |
| - CATransaction.setDisableActions(true) |
103 |
| - CATransaction.setAnimationDuration(0) |
104 |
| - |
105 |
| - testLayer.bounds = CGRect( |
106 |
| - x: 0, |
107 |
| - y: 0, |
108 |
| - width: platformLayer.bounds.width * 0.5, |
109 |
| - height: platformLayer.bounds.height * 0.5 |
110 |
| - ) |
111 |
| - testLayer.position = CGPoint( |
112 |
| - x: platformLayer.frame.midX, |
113 |
| - y: platformLayer.frame.midY |
114 |
| - ) |
115 |
| - |
116 |
| - platformLayer.backgroundColor = PlatformColor.systemBlue.cgColor |
117 |
| - |
118 |
| - CATransaction.commit() |
119 |
| - |
120 |
| - print(#function, bounds, "testLayer:", testLayer.bounds) |
121 |
| - } |
122 |
| -} |
123 |
| - |
124 |
| -@available(macOS 15.0, iOS 18.0, *) |
125 |
| -#Preview { |
126 |
| - TestView(frame: .init(x: 0, y: 0, width: 200, height: 200)) |
127 |
| -} |
128 |
| -#endif |
0 commit comments