diff --git a/Sources/PathBuilder/Path components/Subpath.swift b/Sources/PathBuilder/Path components/Subpath.swift index 0cc9309..e410007 100644 --- a/Sources/PathBuilder/Path components/Subpath.swift +++ b/Sources/PathBuilder/Path components/Subpath.swift @@ -17,9 +17,9 @@ public struct Subpath: PathComponent { /// - Parameters: /// - transform: An affine transform to apply to the subpath before adding to the path. /// - builder: Result builder for creating the path from components. - public init(transform: CGAffineTransform = .identity, @PathBuilder _ builder: () -> Path) { + public init(transform: CGAffineTransform = .identity, @PathBuilder _ builder: () -> PathComponent) { self.transform = transform - self.path = builder() + self.path = Path(builder) } /// Intializes subpath with shape filling the provided rectangle. diff --git a/Sources/PathBuilder/Path+PathBuilder.swift b/Sources/PathBuilder/Path+PathBuilder.swift index a082169..0c34408 100644 --- a/Sources/PathBuilder/Path+PathBuilder.swift +++ b/Sources/PathBuilder/Path+PathBuilder.swift @@ -2,7 +2,7 @@ import SwiftUI public extension Path { /// Initializes path using custom attribute path builder. - init(@PathBuilder _ builder: () -> Path) { - self = builder() + init(@PathBuilder _ builder: () -> PathComponent) { + self = Path(builder().add(to:)) } } diff --git a/Sources/PathBuilder/PathBuilder.swift b/Sources/PathBuilder/PathBuilder.swift index 5aba0c4..3afcb17 100644 --- a/Sources/PathBuilder/PathBuilder.swift +++ b/Sources/PathBuilder/PathBuilder.swift @@ -38,14 +38,6 @@ public struct PathBuilder { public static func buildLimitedAvailability(_ component: PathComponent) -> PathComponent { component } - - /// This will be called on the partial result from the outermost - /// block statement to produce the final returned result `Path`. - public static func buildFinalResult(_ component: PathComponent) -> Path { - Path { path in - component.add(to: &path) - } - } /// This will be called on the final result from the outermost /// block statement to produce the partial `PathComponent`.