Skip to content

Commit 2596bbc

Browse files
committed
Fix linux platform build issue
1 parent 0042d24 commit 2596bbc

File tree

3 files changed

+46
-24
lines changed

3 files changed

+46
-24
lines changed

Sources/OpenSwiftUICore/Extension/CGAffineTransform+Extension.swift

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,48 @@
55
// Audited for iOS 18.0
66
// Status: Complete
77

8-
#if canImport(Darwin)
9-
8+
#if canImport(CoreGraphics)
109
package import CoreGraphics
10+
#else
11+
package import Foundation
12+
// FIXME: Use Silica or other implementation
13+
public struct CGAffineTransform: Equatable {
14+
public init() {
15+
a = .zero
16+
b = .zero
17+
c = .zero
18+
d = .zero
19+
tx = .zero
20+
ty = .zero
21+
}
22+
23+
public init(a: Double, b: Double, c: Double, d: Double, tx: Double, ty: Double) {
24+
self.a = a
25+
self.b = b
26+
self.c = c
27+
self.d = d
28+
self.tx = tx
29+
self.ty = ty
30+
}
31+
32+
public var a: Double
33+
public var b: Double
34+
public var c: Double
35+
public var d: Double
36+
public var tx: Double
37+
public var ty: Double
38+
39+
public static let identity = CGAffineTransform(a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0)
40+
41+
public func concatenating(_ transform: CGAffineTransform) -> CGAffineTransform {
42+
preconditionFailure("Unimplemented")
43+
}
44+
45+
public func inverted() -> CGAffineTransform {
46+
preconditionFailure("Unimplemented")
47+
}
48+
}
49+
#endif
1150

1251
extension CGAffineTransform {
1352
package init(rotation: Angle) {
@@ -78,5 +117,3 @@ extension CGAffineTransform: ProtobufMessage {
78117
self = transform
79118
}
80119
}
81-
82-
#endif

Sources/OpenSwiftUICore/Layout/Geometry/ProjectionTransform.swift

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,6 @@
88
public import Foundation
99
#if canImport(QuartzCore)
1010
public import QuartzCore
11-
#else
12-
// FIXME: Use Silica or other implementation
13-
public struct CGAffineTransform {
14-
public init()
15-
16-
public init(a: Double, b: Double, c: Double, d: Double, tx: Double, ty: Double)
17-
18-
public var a: Double
19-
20-
public var b: Double
21-
22-
public var c: Double
23-
24-
public var d: Double
25-
26-
public var tx: Double
27-
28-
public var ty: Double
29-
}
3011
#endif
3112

3213
@frozen
@@ -200,7 +181,6 @@ extension CGPoint {
200181
}
201182
}
202183

203-
#if canImport(QuartzCore)
204184
extension CGAffineTransform {
205185
package init(_ m: ProjectionTransform) {
206186
self.init(
@@ -211,6 +191,7 @@ extension CGAffineTransform {
211191
}
212192
}
213193

194+
#if canImport(QuartzCore)
214195
extension CATransform3D {
215196
package init(_ m: ProjectionTransform) {
216197
self.init(

Sources/OpenSwiftUICore/Layout/View/ViewTransform.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,8 +705,12 @@ extension [CGPoint]: ApplyViewTransform, ViewTransformable {
705705
case let .translation(offset):
706706
self = map { $0 + offset }
707707
case let .affineTransform(matrix, inverse):
708+
#if canImport(CoreGraphics)
708709
let tranform = inverse ? matrix.inverted() : matrix
709710
self = map { $0.applying(tranform) }
711+
#else
712+
preconditionFailure("CGAffineTransform+applying is not available on this platform")
713+
#endif
710714
case let .projectionTransform(matrix, inverse):
711715
apply(matrix, inverse: inverse)
712716
case .coordinateSpace, .sizedSpace, .scrollGeometry:

0 commit comments

Comments
 (0)