diff --git a/Example/Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Example/Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 0caf752..64cc2e2 100644 --- a/Example/Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Example/Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/asam139/SwifterSwiftUI.git", "state": { "branch": null, - "revision": "e69419dd7cdf3bb7df315978530d621d69c98b88", - "version": "0.5.1" + "revision": "6fc8aed7aa029cba6b6a74659eab9d7190028b20", + "version": "0.5.2" } }, { diff --git a/Package.swift b/Package.swift index d455d0a..253175c 100644 --- a/Package.swift +++ b/Package.swift @@ -17,7 +17,7 @@ let package = Package( ], dependencies: [ // Dependencies declare other packages that this package depends on. - .package(url: "https://github.com/asam139/SwifterSwiftUI.git", .upToNextMajor(from: "0.5.1")), + .package(url: "https://github.com/asam139/SwifterSwiftUI.git", .upToNextMajor(from: "0.5.2")), .package(url: "https://github.com/nalexn/ViewInspector", .upToNextMajor(from: "0.9.5")) ], targets: [ diff --git a/Sources/Steps/Components/Container.swift b/Sources/Steps/Components/Container.swift index c1397b6..951095b 100644 --- a/Sources/Steps/Components/Container.swift +++ b/Sources/Steps/Components/Container.swift @@ -40,10 +40,11 @@ struct Container: View where Content: View { content } .frame(height: config.size + 2 * config.figurePadding) - ifLet(title, then: { Text($0) }) - .fixedSize(horizontal: true, vertical: false) - .lineLimit(1) - + if let title { + Text(title) + .fixedSize(horizontal: true, vertical: false) + .lineLimit(1) + } } .frame(minWidth: 0, maxWidth: .infinity) .onReceive(inspection.notice) { self.inspection.visit(self, $0) } diff --git a/Sources/Steps/Components/Item.swift b/Sources/Steps/Components/Item.swift index 57929b7..fb90f75 100644 --- a/Sources/Steps/Components/Item.swift +++ b/Sources/Steps/Components/Item.swift @@ -84,11 +84,7 @@ struct Item: View { var body: some View { Container(title: step.title) { - ifLet(image, then: { - $0.resizable() - }, else: { - Text("\(step.index + 1)").font(.system(size: config.size)) - }) + element .frame(width: config.size, height: config.size) .padding(config.figurePadding) .if(step.index == state.currentIndex, then: { @@ -108,12 +104,22 @@ struct Item: View { onCompletion: onCompletionEffect ) ) - .animation(config.animation) - .onReceive(state.$currentIndex, perform: { (nextIndex) in - self.updateOffset(nextIndex: nextIndex) - self.previousIndex = nextIndex - }) - .onReceive(inspection.notice) { self.inspection.visit(self, $0) } + .animation(config.animation) + .onReceive(state.$currentIndex, perform: { (nextIndex) in + self.updateOffset(nextIndex: nextIndex) + self.previousIndex = nextIndex + }) + .onReceive(inspection.notice) { self.inspection.visit(self, $0) } + } + + @ViewBuilder + private var element: some View { + if let image { + image.resizable() + } else { + Text("\(step.index + 1)") + .font(.system(size: config.size)) + } } } diff --git a/Steps.podspec b/Steps.podspec index da7005a..896cb6e 100644 --- a/Steps.podspec +++ b/Steps.podspec @@ -20,5 +20,5 @@ Steps is a navigation bar that guides users through the steps of a task. You nee s.source_files = 'Sources/Steps/**/*' s.frameworks = 'SwiftUI', 'Combine' - s.dependency 'SwifterSwiftUI', '~> 0.5.0' + s.dependency 'SwifterSwiftUI', '~> 0.5.2' end