Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7b886e5
feat(shape): implement built-in inset paths
Kyle-Ye Nov 7, 2026
b6bd860
fix(path): align portable PathData storage
Kyle-Ye Nov 7, 2026
8b23a40
build: preserve Swift symbols in XCFrameworks
Kyle-Ye Nov 8, 2026
e883ed0
build: preserve Swift symbols only for local slices
Kyle-Ye Nov 8, 2026
6b3cca1
fix(path): mark PathData.cgPath as nullable
Kyle-Ye Nov 8, 2026
7abe75a
fix(spi): refine CGPath string and rounded rect helpers
Kyle-Ye Nov 16, 2026
ad22b6b
feat(path): complete Path and PathBox implementation
Kyle-Ye Nov 21, 2026
5bc75be
feat(shape): complete ShapeType path classification
Kyle-Ye Nov 17, 2026
df19da3
chore: update dependency
Kyle-Ye Nov 21, 2026
eb45909
feat(shape): add StrokeStyle(ORBPathStrokeStyle) initializer
Kyle-Ye Nov 21, 2026
e2f109f
refactor(path): use ORBPath.Callbacks.cgPath directly
Kyle-Ye Nov 21, 2026
a98f16e
fix(core): bridge Data and CFData on non-Darwin platforms
Kyle-Ye Nov 22, 2026
8533f8d
feat(path): support Path.cgPath on non-Darwin platforms
Kyle-Ye Nov 22, 2026
3875073
feat(path): support Path string parsing and description on non-Darwin…
Kyle-Ye Nov 22, 2026
f83d140
refactor(path): remove OPENSWIFTUI_CF_CGTYPES conditional
Kyle-Ye Nov 22, 2026
5c37adc
chore: update dependency
Kyle-Ye Nov 22, 2026
15cf217
test(path): redesign Path, TrimmedPath, and FixedRoundedRect unit tests
Kyle-Ye Nov 22, 2026
5a660ff
docs(skills): prefer DocC examples in UI tests
Kyle-Ye Nov 22, 2026
aa8bff9
feat(example): add Path and Shape examples and UI tests
Kyle-Ye Nov 22, 2026
1c6e04e
chore(example): restore path, stroke, and border modifiers in examples
Kyle-Ye Nov 22, 2026
978c754
feat(example): add PathPlayground showcase
Kyle-Ye Nov 22, 2026
8ff339f
fix(displaylist): add space before path description in SExp printer
Kyle-Ye Nov 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Follow the nearest test under `Example/Tests/OpenSwiftUIUITests`.

- Exercise public API through rendered example content. Add or change shared
example content only when the requested UI test needs an entry point.
- Prefer examples from official DocC documentation and SDK doc comments for the
target API when authoring shared examples and UI snapshot cases, adapting
only as needed for deterministic sizing, layout, or supported dependencies.
- Use the existing snapshot helpers, suite traits, and platform guards instead of
introducing a parallel harness.
- Make layout, state, and timing deterministic enough that the snapshot represents
Expand Down
9 changes: 4 additions & 5 deletions Example/Shared/Layout/CustomLayout/FlowLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ struct FlowLayoutDemo: View {
}
}
.padding()
// .background(.thinMaterial, in: RoundedRectangle(cornerRadius: 16))
.background(.thinMaterial, in: RoundedRectangle(cornerRadius: 16))

// GroupBox("Fixed width container (320)") {
// FlowLayout(spacing: 8, rowSpacing: 8, alignment: .center, maxRowWidth: 320) {
Expand Down Expand Up @@ -194,9 +194,8 @@ private struct TagChip: View {
.padding(.horizontal, 12)
.padding(.vertical, 6)
.background(Color.accentColor.opacity(0.12), in: Capsule())
// TODO: strokePath is not supported yet.
// .overlay {
// Capsule().strokeBorder(Color.accentColor.opacity(0.35))
// }
.overlay {
Capsule().strokeBorder(Color.accentColor.opacity(0.35))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ struct MatchedGeometryEffectModifierExample: View {
}
}
.frame(width: 250).padding(10)
// TODO: strokePath not implemented
// .border(Color.gray, width: 3)
.border(Color.gray, width: 3)
}
}

Expand Down Expand Up @@ -93,8 +92,7 @@ struct MatchedGeometryEffectClipShapeModifierExample: View {
}
}
.frame(width: 250).padding(10)
// TODO: strokePath not implemented
// .border(Color.gray, width: 3)
.border(Color.gray, width: 3)
}
}

Expand Down
10 changes: 9 additions & 1 deletion Example/Shared/Shape/FlowerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// FlowerView.swift
// Shared

import Foundation
#if OPENSWIFTUI
import OpenSwiftUI
#else
import SwiftUI
#endif
import Foundation

struct FlowerView: View {
var body: some View {
Expand Down Expand Up @@ -44,3 +44,11 @@ struct FlowerViewAnimation: View {
.task { animate = true }
}
}

#Preview("Static") {
FlowerView()
}

#Preview("Animated") {
FlowerViewAnimation()
}
280 changes: 280 additions & 0 deletions Example/Shared/Shape/Path/PathExample.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,280 @@
//
// PathExample.swift
// Shared

import Foundation
#if OPENSWIFTUI
import OpenSwiftUI
#else
import SwiftUI
#endif

struct PathTrimExample: View {
enum RangeKind: String, CaseIterable {
case full
case threeQuarters
case leftLobe

var fractions: (start: CGFloat, end: CGFloat) {
switch self {
case .full: (0.0, 1.0)
case .threeQuarters: (0.25, 1.0)
case .leftLobe: (0.0, 0.5)
}
}
}

var range: RangeKind = .threeQuarters

var body: some View {
let fractions = range.fractions
Path { path in
path.addLines([
.init(x: 2, y: 1),
.init(x: 1, y: 0),
.init(x: 0, y: 1),
.init(x: 1, y: 2),
.init(x: 3, y: 0),
.init(x: 4, y: 1),
.init(x: 3, y: 2),
.init(x: 2, y: 1),
])
}
.applying(CGAffineTransform(translationX: 20, y: 60).scaledBy(x: 40, y: 40))
.trim(from: fractions.start, to: fractions.end)
.stroke(Color.primary, lineWidth: 3)
.frame(width: 200, height: 200)
}
}

struct PathArcSectorExample: View {
var body: some View {
Path { path in
path.move(to: CGPoint(x: 40, y: 40))
path.addLine(to: CGPoint(x: 160, y: 40))
path.addArc(
center: CGPoint(x: 40, y: 40),
radius: 120,
startAngle: .zero,
endAngle: .degrees(90),
clockwise: false
)
path.closeSubpath()
}
.fill(.orange)
.stroke(.red, lineWidth: 4)
.frame(width: 200, height: 200)
}
}

struct PathTrapezoidBackgroundExample: View {
enum StyleKind: String, CaseIterable {
case explicitTeal
case defaultBackground
}

var styleKind: StyleKind = .explicitTeal

private var trapezoid: Path {
Path { path in
path.move(to: .zero)
path.addLine(to: CGPoint(x: 90, y: 0))
path.addLine(to: CGPoint(x: 80, y: 50))
path.addLine(to: CGPoint(x: 10, y: 50))
path.closeSubpath()
}
}

private var flagIcon: some View {
Path { path in
path.move(to: CGPoint(x: 2, y: 1))
path.addLine(to: CGPoint(x: 2, y: 15))
path.move(to: CGPoint(x: 2, y: 2))
path.addLine(to: CGPoint(x: 14, y: 5))
path.addLine(to: CGPoint(x: 2, y: 9))
path.closeSubpath()
}
.fill(.primary)
.stroke(.primary, lineWidth: 1.5)
.frame(width: 16, height: 16)
}

var body: some View {
switch styleKind {
case .explicitTeal:
HStack(spacing: 6) {
flagIcon
Text("Flag")
}
.frame(width: 90, height: 50)
.background(.teal, in: trapezoid)
case .defaultBackground:
ZStack {
Color.teal
HStack(spacing: 6) {
flagIcon
Text("Flag")
}
.frame(width: 90, height: 50)
.background(in: trapezoid)
}
.frame(width: 160, height: 100)
}
}
}

struct PathCurvesAndFillRuleExample: View {
enum Variant: String, CaseIterable {
case bezierBadge
case evenOddRings
case nonZeroRings
case starFromString
}

var variant: Variant = .bezierBadge

private var concentricRings: Path {
Path { path in
path.addEllipse(in: CGRect(x: 30, y: 30, width: 140, height: 140))
path.addEllipse(in: CGRect(x: 65, y: 65, width: 70, height: 70))
}
}

var body: some View {
Group {
switch variant {
case .bezierBadge:
Path { path in
path.move(to: CGPoint(x: 30, y: 110))
path.addQuadCurve(
to: CGPoint(x: 170, y: 110),
control: CGPoint(x: 100, y: 20)
)
path.addCurve(
to: CGPoint(x: 30, y: 110),
control1: CGPoint(x: 150, y: 185),
control2: CGPoint(x: 50, y: 185)
)
path.closeSubpath()
}
.fill(.indigo)
.stroke(.cyan, lineWidth: 4)
case .evenOddRings:
concentricRings
.fill(.teal, style: FillStyle(eoFill: true))
case .nonZeroRings:
concentricRings
.fill(.teal, style: FillStyle(eoFill: false))
case .starFromString:
(Path("100 25 m 123 165 l 30 78 l 170 78 l 77 165 l h") ?? Path())
.fill(.purple, style: FillStyle(eoFill: true))
}
}
.frame(width: 200, height: 200)
}
}

struct PathBooleanExample: View {
enum Operation: String, CaseIterable {
case union
case intersection
case subtracting
case symmetricDifference
case lineIntersection
case lineSubtraction
}

var operation: Operation = .symmetricDifference

private var circlePath: Path {
Path(ellipseIn: CGRect(x: 25, y: 45, width: 110, height: 110))
}

private var roundedRectPath: Path {
Path(roundedRect: CGRect(x: 65, y: 45, width: 110, height: 110), cornerRadius: 24)
}

private var stripeLines: Path {
Path { path in
for y in stride(from: 45.0, through: 155.0, by: 18.0) {
path.move(to: CGPoint(x: 20, y: y))
path.addLine(to: CGPoint(x: 180, y: y))
}
}
}

var body: some View {
Group {
switch operation {
case .union:
circlePath.union(roundedRectPath)
.fill(.blue)
case .intersection:
circlePath.intersection(roundedRectPath)
.fill(.green)
case .subtracting:
circlePath.subtracting(roundedRectPath)
.fill(.orange)
case .symmetricDifference:
circlePath.symmetricDifference(roundedRectPath)
.fill(.pink)
case .lineIntersection:
stripeLines.lineIntersection(circlePath)
.stroke(.teal, style: StrokeStyle(lineWidth: 4, lineCap: .round))
case .lineSubtraction:
stripeLines.lineSubtraction(circlePath)
.stroke(.indigo, style: StrokeStyle(lineWidth: 4, lineCap: .round))
}
}
.frame(width: 200, height: 200)
}
}

#Preview("Trim Infinity") {
VStack {
PathTrimExample(range: .threeQuarters)
PathTrimExample(range: .leftLobe)
}
}

#Preview("Arc Sector") {
PathArcSectorExample()
}

#Preview("Trapezoid Background") {
VStack(spacing: 16) {
PathTrapezoidBackgroundExample(styleKind: .explicitTeal)
PathTrapezoidBackgroundExample(styleKind: .defaultBackground)
}
.padding()
}

#Preview("Curves & Fill Rules") {
VStack {
HStack {
PathCurvesAndFillRuleExample(variant: .bezierBadge)
PathCurvesAndFillRuleExample(variant: .starFromString)
}
HStack {
PathCurvesAndFillRuleExample(variant: .evenOddRings)
PathCurvesAndFillRuleExample(variant: .nonZeroRings)
}
}
}

#Preview("Boolean Operations") {
VStack {
HStack {
PathBooleanExample(operation: .union)
PathBooleanExample(operation: .intersection)
}
HStack {
PathBooleanExample(operation: .subtracting)
PathBooleanExample(operation: .symmetricDifference)
}
HStack {
PathBooleanExample(operation: .lineIntersection)
PathBooleanExample(operation: .lineSubtraction)
}
}
}
Loading
Loading