Skip to content

Commit

Permalink
Update examples and fix deprecation warning (#153)
Browse files Browse the repository at this point in the history
* Update examples and fix deprecation warning

* wip

* wip
  • Loading branch information
stephencelis authored May 20, 2024
1 parent ec3b0f9 commit 2b7a69b
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 152 deletions.
25 changes: 12 additions & 13 deletions Examples/CaseStudies/01-Alerts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,18 @@ struct OptionalAlerts: View {
}
.disabled(self.model.isLoading)
}
.alert(
title: { Text("Fact about \($0.number)") },
unwrapping: self.$model.fact,
actions: {
Button("Get another fact about \($0.number)") {
Task { await self.model.numberFactButtonTapped() }
}
Button("Close", role: .cancel) {
self.model.fact = nil
}
},
message: { Text($0.description) }
)
.alert(item: self.$model.fact) {
Text("Fact about \($0.number)")
} actions: {
Button("Get another fact about \($0.number)") {
Task { await self.model.numberFactButtonTapped() }
}
Button("Close", role: .cancel) {
self.model.fact = nil
}
} message: {
Text($0.description)
}
.navigationTitle("Alerts")
}
}
Expand Down
20 changes: 9 additions & 11 deletions Examples/CaseStudies/02-ConfirmationDialogs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,15 @@ struct OptionalConfirmationDialogs: View {
}
}
.disabled(self.model.isLoading)
.confirmationDialog(
title: { Text("Fact about \($0.number)") },
titleVisibility: .visible,
unwrapping: self.$model.fact,
actions: {
Button("Get another fact about \($0.number)") {
Task { await self.model.numberFactButtonTapped() }
}
},
message: { Text($0.description) }
)
.confirmationDialog(item: self.$model.fact, titleVisibility: .visible) {
Text("Fact about \($0.number)")
} actions: {
Button("Get another fact about \($0.number)") {
Task { await self.model.numberFactButtonTapped() }
}
} message: {
Text($0.description)
}
}
.navigationTitle("Dialogs")
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftUINavigation/Internal/Deprecations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}

@available(
*, deprecated, renamed: "confirmationDialog(item:textVisibility:title:actions:message:)"
*, deprecated, renamed: "confirmationDialog(item:titleVisibility:title:actions:message:)"
)
public func confirmationDialog<Value, A: View, M: View>(
title: (Value) -> Text,
Expand Down
240 changes: 119 additions & 121 deletions SwiftUINavigation.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -1,124 +1,122 @@
{
"object": {
"pins": [
{
"package": "combine-schedulers",
"repositoryURL": "https://github.com/pointfreeco/combine-schedulers",
"state": {
"branch": null,
"revision": "9dc9cbe4bc45c65164fa653a563d8d8db61b09bb",
"version": "1.0.0"
}
},
{
"package": "swift-case-paths",
"repositoryURL": "https://github.com/pointfreeco/swift-case-paths",
"state": {
"branch": null,
"revision": "8cc3bc05d0cc956f7374c6c208a11f66a7cac3db",
"version": "1.2.2"
}
},
{
"package": "swift-clocks",
"repositoryURL": "https://github.com/pointfreeco/swift-clocks",
"state": {
"branch": null,
"revision": "a8421d68068d8f45fbceb418fbf22c5dad4afd33",
"version": "1.0.2"
}
},
{
"package": "swift-collections",
"repositoryURL": "https://github.com/apple/swift-collections",
"state": {
"branch": null,
"revision": "d029d9d39c87bed85b1c50adee7c41795261a192",
"version": "1.0.6"
}
},
{
"package": "swift-concurrency-extras",
"repositoryURL": "https://github.com/pointfreeco/swift-concurrency-extras",
"state": {
"branch": null,
"revision": "bb5059bde9022d69ac516803f4f227d8ac967f71",
"version": "1.1.0"
}
},
{
"package": "swift-custom-dump",
"repositoryURL": "https://github.com/pointfreeco/swift-custom-dump",
"state": {
"branch": null,
"revision": "aedcf6f4cd486ccef5b312ccac85d4b3f6e58605",
"version": "1.1.2"
}
},
{
"package": "swift-dependencies",
"repositoryURL": "http://github.com/pointfreeco/swift-dependencies",
"state": {
"branch": null,
"revision": "c31b1445c4fae49e6fdb75496b895a3653f6aefc",
"version": "1.1.5"
}
},
{
"package": "SwiftDocCPlugin",
"repositoryURL": "https://github.com/apple/swift-docc-plugin",
"state": {
"branch": null,
"revision": "26ac5758409154cc448d7ab82389c520fa8a8247",
"version": "1.3.0"
}
},
{
"package": "SymbolKit",
"repositoryURL": "https://github.com/apple/swift-docc-symbolkit",
"state": {
"branch": null,
"revision": "b45d1f2ed151d057b54504d653e0da5552844e34",
"version": "1.0.0"
}
},
{
"package": "swift-identified-collections",
"repositoryURL": "https://github.com/pointfreeco/swift-identified-collections.git",
"state": {
"branch": null,
"revision": "d1e45f3e1eee2c9193f5369fa9d70a6ddad635e8",
"version": "1.0.0"
}
},
{
"package": "swift-syntax",
"repositoryURL": "https://github.com/apple/swift-syntax.git",
"state": {
"branch": null,
"revision": "6ad4ea24b01559dde0773e3d091f1b9e36175036",
"version": "509.0.2"
}
},
{
"package": "swift-tagged",
"repositoryURL": "https://github.com/pointfreeco/swift-tagged.git",
"state": {
"branch": null,
"revision": "3907a9438f5b57d317001dc99f3f11b46882272b",
"version": "0.10.0"
}
},
{
"package": "xctest-dynamic-overlay",
"repositoryURL": "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state": {
"branch": null,
"revision": "23cbf2294e350076ea4dbd7d5d047c1e76b03631",
"version": "1.0.2"
}
"pins" : [
{
"identity" : "combine-schedulers",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/combine-schedulers",
"state" : {
"revision" : "9dc9cbe4bc45c65164fa653a563d8d8db61b09bb",
"version" : "1.0.0"
}
]
},
"version": 1
},
{
"identity" : "swift-case-paths",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-case-paths",
"state" : {
"revision" : "8cc3bc05d0cc956f7374c6c208a11f66a7cac3db",
"version" : "1.2.2"
}
},
{
"identity" : "swift-clocks",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-clocks",
"state" : {
"revision" : "a8421d68068d8f45fbceb418fbf22c5dad4afd33",
"version" : "1.0.2"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections",
"state" : {
"revision" : "d029d9d39c87bed85b1c50adee7c41795261a192",
"version" : "1.0.6"
}
},
{
"identity" : "swift-concurrency-extras",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-concurrency-extras",
"state" : {
"revision" : "bb5059bde9022d69ac516803f4f227d8ac967f71",
"version" : "1.1.0"
}
},
{
"identity" : "swift-custom-dump",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-custom-dump",
"state" : {
"revision" : "aedcf6f4cd486ccef5b312ccac85d4b3f6e58605",
"version" : "1.1.2"
}
},
{
"identity" : "swift-dependencies",
"kind" : "remoteSourceControl",
"location" : "http://github.com/pointfreeco/swift-dependencies",
"state" : {
"revision" : "c31b1445c4fae49e6fdb75496b895a3653f6aefc",
"version" : "1.1.5"
}
},
{
"identity" : "swift-docc-plugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-docc-plugin",
"state" : {
"revision" : "26ac5758409154cc448d7ab82389c520fa8a8247",
"version" : "1.3.0"
}
},
{
"identity" : "swift-docc-symbolkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-docc-symbolkit",
"state" : {
"revision" : "b45d1f2ed151d057b54504d653e0da5552844e34",
"version" : "1.0.0"
}
},
{
"identity" : "swift-identified-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-identified-collections.git",
"state" : {
"revision" : "d1e45f3e1eee2c9193f5369fa9d70a6ddad635e8",
"version" : "1.0.0"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"revision" : "6ad4ea24b01559dde0773e3d091f1b9e36175036",
"version" : "509.0.2"
}
},
{
"identity" : "swift-tagged",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-tagged.git",
"state" : {
"revision" : "3907a9438f5b57d317001dc99f3f11b46882272b",
"version" : "0.10.0"
}
},
{
"identity" : "xctest-dynamic-overlay",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "23cbf2294e350076ea4dbd7d5d047c1e76b03631",
"version" : "1.0.2"
}
}
],
"version" : 2
}
16 changes: 10 additions & 6 deletions Tests/SwiftUINavigationTests/BindingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,19 @@
}

func testDestinationCannotReplaceOtherDestination() throws {
@Binding var destination: Status?
_destination = Binding(initialValue: .inStock(quantity: 1))
#if os(iOS) || os(macOS)
try XCTSkipIf(ProcessInfo.processInfo.environment["CI"] != nil)

let inStock = try XCTUnwrap($destination.inStock)
@Binding var destination: Status?
_destination = Binding(initialValue: .inStock(quantity: 1))

destination = .outOfStock(isOnBackOrder: true)
let inStock = try XCTUnwrap($destination.inStock)

inStock.wrappedValue = 42
XCTAssertEqual(destination, .outOfStock(isOnBackOrder: true))
destination = .outOfStock(isOnBackOrder: true)

inStock.wrappedValue = 42
XCTAssertEqual(destination, .outOfStock(isOnBackOrder: true))
#endif
}
}

Expand Down

0 comments on commit 2b7a69b

Please sign in to comment.