Skip to content

Commit

Permalink
Update and solve conflict with SwifterSwiftUI
Browse files Browse the repository at this point in the history
  • Loading branch information
asam139 committed Sep 11, 2023
1 parent 5ddb114 commit 0e1f886
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
9 changes: 5 additions & 4 deletions Sources/Steps/Components/Container.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ struct Container<Content>: 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) }
Expand Down
28 changes: 17 additions & 11 deletions Sources/Steps/Components/Item.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,7 @@ struct Item<Element>: 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: {
Expand All @@ -108,12 +104,22 @@ struct Item<Element>: 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))
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion Steps.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 0e1f886

Please sign in to comment.