Skip to content

Commit babb23b

Browse files
committed
Update the readme chapter of FAQ about NavigationLink as well, update the demo
1 parent 72c604d commit babb23b

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Example/SDWebImageSwiftUIDemo/ContentView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ struct ContentView: View {
141141
Text((url as NSString).lastPathComponent)
142142
}
143143
}
144+
.buttonStyle(PlainButtonStyle())
144145
}
145146
.onDelete { indexSet in
146147
indexSet.forEach { index in

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,15 @@ Button(action: {
218218
}) {
219219
WebImage(url: url)
220220
}
221+
// NavigationLink create Button implicitly
222+
NavigationView {
223+
NavigationLink(destination: Text("Detail view here")) {
224+
WebImage(url: url)
225+
}
226+
}
221227
```
222228

223-
Instead, you must override the `.buttonStyle` to use the plain style. Or you can use the `.onTapGesture` modifier for touch handling. See [How to disable the overlay color for images inside Button and NavigationLink](https://www.hackingwithswift.com/quick-start/swiftui/how-to-disable-the-overlay-color-for-images-inside-button-and-navigationlink)
229+
Instead, you must override the `.buttonStyle` to use the plain style, or the `.renderingMode` to use original mode. You can also use the `.onTapGesture` modifier for touch handling. See [How to disable the overlay color for images inside Button and NavigationLink](https://www.hackingwithswift.com/quick-start/swiftui/how-to-disable-the-overlay-color-for-images-inside-button-and-navigationlink)
224230

225231
```swift
226232
// Correct
@@ -230,6 +236,13 @@ Button(action: {
230236
AnimatedImage(url: url)
231237
}
232238
.buttonStyle(PlainButtonStyle())
239+
// Or
240+
NavigationView {
241+
NavigationLink(destination: Text("Detail view here")) {
242+
WebImage(url: url)
243+
.renderingMode(.original)
244+
}
245+
}
233246
```
234247

235248
## Demo

0 commit comments

Comments
 (0)