From c9d46e6aebb469609c4267ae31ad6a743c5740d4 Mon Sep 17 00:00:00 2001 From: wzso Date: Fri, 21 Jul 2023 15:11:35 +0800 Subject: [PATCH 1/4] Add library content provider support --- Sources/PathBuilder/LibraryContent.swift | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Sources/PathBuilder/LibraryContent.swift diff --git a/Sources/PathBuilder/LibraryContent.swift b/Sources/PathBuilder/LibraryContent.swift new file mode 100644 index 0000000..22ff42a --- /dev/null +++ b/Sources/PathBuilder/LibraryContent.swift @@ -0,0 +1,43 @@ +// +// File.swift +// +// +// Created by Vincent on 21/7/2023. +// + +import SwiftUI +import DeveloperToolsSupport + +@available(macOS 11.0, *) +struct LibraryContent: LibraryContentProvider { + var views: [LibraryItem] { + LibraryItem( + Path { + Move(to: CGPoint(x: 0, y: 0)) + // ... + Close() + } + ) + LibraryItem( + Subpath { + Move(to: CGPoint(x: 0, y: 0)) + // ... + } + ) + LibraryItem(Arc(center: .zero, radius: 20, startAngle: .zero, endAngle: .degrees(180))) + LibraryItem(Close()) + LibraryItem(Curve(to: CGPoint(x: 10, y: 10), control1: CGPoint(x: 5, y: 5), control2: CGPoint(x: 10, y: 10))) + LibraryItem(EmptySubpath()) + LibraryItem(Line(to: CGPoint(x: 50, y: 50))) + LibraryItem(Lines(CGPoint(x: 60, y: 60), CGPoint(x: 70, y: 70))) + LibraryItem(Loop(sequence: 0..<10) { i in + Line(to: CGPoint(x: i * 5, y: i * 5)) + }) + LibraryItem(Oval(in: CGRect(x: 0, y: 0, width: 10, height: 20))) + LibraryItem(QuadCurve(to: CGPoint(x: 0, y: 0), control: CGPoint(x: 10, y: 10))) + LibraryItem(Rect(CGRect(x: 0, y: 0, width: 100, height: 100), CGRect(x: 10, y: 10, width: 20, height: 30))) + LibraryItem(RelativeArc(center: CGPoint(x: 0, y: 0), radius: 10, startAngle: .degrees(60), delta: .degrees(180))) + LibraryItem(RoundedRect(in: CGRect(x: 10, y: 10, width: 20, height: 30), cornerSize: CGSize(width: 5, height: 10))) + LibraryItem(TangentArc(end1: CGPoint(x: 0, y: 0), end2: CGPoint(x: 10, y: 10), radius: 3)) + } +} From d30470812012bd44c5e95d7d4c32332349f79562 Mon Sep 17 00:00:00 2001 From: wzso Date: Fri, 21 Jul 2023 15:13:23 +0800 Subject: [PATCH 2/4] Remove comments --- Sources/PathBuilder/LibraryContent.swift | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Sources/PathBuilder/LibraryContent.swift b/Sources/PathBuilder/LibraryContent.swift index 22ff42a..3756e6e 100644 --- a/Sources/PathBuilder/LibraryContent.swift +++ b/Sources/PathBuilder/LibraryContent.swift @@ -1,10 +1,3 @@ -// -// File.swift -// -// -// Created by Vincent on 21/7/2023. -// - import SwiftUI import DeveloperToolsSupport From e183ee456ae5867b56fa4a34d26e4899b84ffc59 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Sat, 22 Jul 2023 17:29:20 +0800 Subject: [PATCH 3/4] Update Sources/PathBuilder/LibraryContent.swift MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matěj Kašpar Jirásek --- Sources/PathBuilder/LibraryContent.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/PathBuilder/LibraryContent.swift b/Sources/PathBuilder/LibraryContent.swift index 3756e6e..15ad6ec 100644 --- a/Sources/PathBuilder/LibraryContent.swift +++ b/Sources/PathBuilder/LibraryContent.swift @@ -1,7 +1,7 @@ import SwiftUI import DeveloperToolsSupport -@available(macOS 11.0, *) +@available(macOS 11.0, iOS 14.0, tvOS 14.0, watchOS 7.0, *) struct LibraryContent: LibraryContentProvider { var views: [LibraryItem] { LibraryItem( From 50646b2b39093c79170aa289cddbf951f171ae95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Ka=C5=A1par=20Jir=C3=A1sek?= Date: Sat, 22 Jul 2023 12:27:16 +0200 Subject: [PATCH 4/4] Remove Loop from library content --- Sources/PathBuilder/LibraryContent.swift | 3 --- 1 file changed, 3 deletions(-) diff --git a/Sources/PathBuilder/LibraryContent.swift b/Sources/PathBuilder/LibraryContent.swift index 15ad6ec..d7c198a 100644 --- a/Sources/PathBuilder/LibraryContent.swift +++ b/Sources/PathBuilder/LibraryContent.swift @@ -23,9 +23,6 @@ struct LibraryContent: LibraryContentProvider { LibraryItem(EmptySubpath()) LibraryItem(Line(to: CGPoint(x: 50, y: 50))) LibraryItem(Lines(CGPoint(x: 60, y: 60), CGPoint(x: 70, y: 70))) - LibraryItem(Loop(sequence: 0..<10) { i in - Line(to: CGPoint(x: i * 5, y: i * 5)) - }) LibraryItem(Oval(in: CGRect(x: 0, y: 0, width: 10, height: 20))) LibraryItem(QuadCurve(to: CGPoint(x: 0, y: 0), control: CGPoint(x: 10, y: 10))) LibraryItem(Rect(CGRect(x: 0, y: 0, width: 100, height: 100), CGRect(x: 10, y: 10, width: 20, height: 30)))