Skip to content

Commit 45a77a2

Browse files
authored
Gardening some examples (pointfreeco#64)
* Gardening some examples * Revert variable names
1 parent f3ccc0b commit 45a77a2

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

Sources/SwiftUINavigation/Documentation.docc/Articles/Bindings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ object and synchronizing it to view state with the `bind` view modifier that shi
1414
library.
1515

1616
For example, suppose you have a sign in flow where if the API request to sign in fails, you want
17-
to refocus the email field. The model can be implement like so:
17+
to refocus the email field. The model can be implemented like so:
1818

1919
```swift
2020
class SignInModel: ObservableObject {

Sources/SwiftUINavigation/Documentation.docc/Articles/DestructuringViews.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct EditView: View {
3636
}
3737
}
3838
} else: {
39-
Text("\(self.string)")
39+
Text(self.string)
4040
Button("Edit") {
4141
self.editableString = self.string
4242
}
@@ -47,7 +47,7 @@ struct EditView: View {
4747
}
4848
```
4949

50-
This is the most optimal way to model this domain. Without the ability to deriving a
50+
This is the most optimal way to model this domain. Without the ability to derive a
5151
`Binding<String>` from a `Binding<String?>` we would have had to hold onto extra state to represent
5252
whether or not we are in editing mode:
5353

@@ -94,15 +94,15 @@ struct EditView: View {
9494
TextField("Edit string", text: $string)
9595
HStack {
9696
Button("Cancel") {
97-
self.editableString = nil
97+
self.editableString = .inactive
9898
}
9999
Button("Save") {
100100
self.string = string
101-
self.editableString = nil
101+
self.editableString = .inactive
102102
}
103103
}
104104
} else: {
105-
Text("\(self.string)")
105+
Text(self.string)
106106
Button("Edit") {
107107
self.editableString = .active(self.string)
108108
}
@@ -136,7 +136,7 @@ enum ItemStatus {
136136
case outOfStock(isOnBackOrder: Bool)
137137
}
138138

139-
struct InventoryItemView {
139+
struct InventoryItemView: View {
140140
@State var status: ItemStatus
141141

142142
var body: some View {

Sources/SwiftUINavigation/IfCaseLet.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import SwiftUI
1515
/// case outOfStock(isOnBackOrder: Bool)
1616
/// }
1717
///
18-
/// struct InventoryItemView {
18+
/// struct InventoryItemView: View {
1919
/// @State var status: ItemStatus
2020
///
2121
/// var body: some View {

Sources/SwiftUINavigation/IfLet.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import SwiftUI
1111
/// optional binding.
1212
///
1313
/// ```swift
14-
/// struct InventoryItemView {
14+
/// struct InventoryItemView: View {
1515
/// @State var quantity: Int?
1616
///
1717
/// var body: some View {

Sources/SwiftUINavigation/Switch.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import SwiftUI
1515
/// case outOfStock(isOnBackOrder: Bool)
1616
/// }
1717
///
18-
/// struct InventoryItemView {
18+
/// struct InventoryItemView: View {
1919
/// @State var status: ItemStatus
2020
///
2121
/// var body: some View {

0 commit comments

Comments
 (0)