Skip to content

Commit 21542f3

Browse files
Fix compilation issues
1 parent 95c2377 commit 21542f3

4 files changed

Lines changed: 39 additions & 4 deletions

File tree

Sources/StitchSchemaKit/SchemaVersions.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ public typealias CurrentStrokeLineJoin = StrokeLineJoin_V20
8585
public typealias CurrentStitchStringValue = StitchStringValue_V20
8686
public typealias CurrentStitchContentMode = StitchContentMode_V20
8787
public typealias CurrentStitchSpacing = StitchSpacing_V20
88+
public typealias CurrentStitchPadding = StitchPadding_V20
89+
public typealias CurrentSizingScenario = SizingScenario_V20
8890

8991
// MARK: - end
9092

@@ -166,6 +168,8 @@ public typealias StrokeLineJoin = CurrentStrokeLineJoin.StrokeLineJoin
166168
public typealias StitchStringValue = CurrentStitchStringValue.StitchStringValue
167169
public typealias StitchContentMode = CurrentStitchContentMode.StitchContentMode
168170
public typealias StitchSpacing = CurrentStitchSpacing.StitchSpacing
171+
public typealias StitchPadding = CurrentStitchPadding.StitchPadding
172+
public typealias SizingScenario = CurrentSizingScenario.SizingScenario
169173

170174
public enum StitchSchemaVersion: Int, VersionType {
171175
case _V1 = 1

Sources/StitchSchemaKit/V20/NodePort/PortValue_V20.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public enum PortValue_V20: StitchSchemaVersionable {
5858
public typealias StitchContentMode = StitchContentMode_V20.StitchContentMode
5959
public typealias StitchSpacing = StitchSpacing_V20.StitchSpacing
6060
public typealias StitchPadding = StitchPadding_V20.StitchPadding
61+
public typealias SizingScenario = SizingScenario_V20.SizingScenario
6162
// MARK: - end
6263

6364
public enum PortValue: Codable, Equatable {
@@ -114,6 +115,7 @@ public enum PortValue_V20: StitchSchemaVersionable {
114115
case contentMode(StitchContentMode)
115116
case spacing(StitchSpacing)
116117
case padding(StitchPadding)
118+
case sizingScenario(SizingScenario)
117119
}
118120
}
119121

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//
2+
// SizingScenario.swift
3+
//
4+
//
5+
// Created by Christian J Clampitt on 7/9/24.
6+
//
7+
8+
import Foundation
9+
import SwiftUI
10+
11+
public enum SizingScenario_V20: StitchSchemaVersionable {
12+
// MARK: - ensure versions are correct
13+
static let version = StitchSchemaVersion._V20
14+
public typealias PreviousInstance = Self.SizingScenario
15+
// MARK: - end
16+
17+
// A version of SwiftUI's ContentMode that is Codable and that we own.
18+
public enum SizingScenario: String, Equatable, Hashable, Codable, CaseIterable {
19+
case auto = "Auto", // manually specify both H and W
20+
constrainHeight = "Constrain Height", // manually specify W; H will follow
21+
constrainWidth = "Constrain Width" // manually specify H; W will follow
22+
}
23+
}
24+
25+
extension SizingScenario_V20.SizingScenario: StitchVersionedCodable {
26+
public init(previousInstance: SizingScenario_V20.PreviousInstance) {
27+
fatalError() // Added in V20
28+
}
29+
}

Sources/StitchSchemaKit/V20/PortValueTypes/StitchPadding_V20.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ public enum StitchPadding_V20: StitchSchemaVersionable {
1616

1717
// TODO: combine with Point4D ? Or will the names `x, y, z, w` be too unfamiliar vers `top`, `bottom` etc.; e.g. does `x` refer to `left` or `right`?
1818
public struct StitchPadding: Equatable, Hashable, Codable {
19-
var top: CGFloat = .zero
20-
var right: CGFloat = .zero
21-
var bottom: CGFloat = .zero
22-
var left: CGFloat = .zero
19+
public var top: CGFloat = .zero
20+
public var right: CGFloat = .zero
21+
public var bottom: CGFloat = .zero
22+
public var left: CGFloat = .zero
2323
}
2424
}
2525

0 commit comments

Comments
 (0)