File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed
Example/SDWebImageSwiftUIDemo Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -45,18 +45,33 @@ struct DetailView: View {
45
45
}
46
46
47
47
func zoomView( ) -> some View {
48
- #if os(macOS) || os(iOS) || os(tvOS)
48
+ #if os(macOS) || os(iOS)
49
49
return contentView ( )
50
50
. scaleEffect ( self . scale)
51
- . gesture ( MagnificationGesture ( minimumScaleDelta: 0.1 ) . onChanged { value in
51
+ . gesture ( MagnificationGesture ( minimumScaleDelta: 0.1 ) . onChanged { value in
52
52
let delta = value / self . lastScaleValue
53
53
self . lastScaleValue = value
54
54
let newScale = self . scale * delta
55
55
self . scale = min ( max ( newScale, 0.5 ) , 2 )
56
56
} . onEnded { value in
57
57
self . lastScaleValue = 1.0
58
58
} )
59
- #else
59
+ #endif
60
+ #if os(tvOS)
61
+ return contentView ( )
62
+ . scaleEffect ( self . scale)
63
+ . focusable ( true )
64
+ . onPlayPauseCommand {
65
+ switch self . scale {
66
+ case 1 :
67
+ self . scale = 2
68
+ case 2 :
69
+ self . scale = 1
70
+ default : break
71
+ }
72
+ }
73
+ #endif
74
+ #if os(watchOS)
60
75
return contentView ( )
61
76
// SwiftUI's bug workaround (watchOS 6.1)
62
77
// If use `.focusable(true)` here, after pop the Detail view, the Content view's List does not get focus again
Original file line number Diff line number Diff line change @@ -268,7 +268,8 @@ Demo Tips:
268
268
1 . Use ` Switch ` (right-click on macOS/force press on watchOS) to switch between ` WebImage ` and ` AnimatedImage ` .
269
269
2 . Use ` Reload ` (right-click on macOS/force press on watchOS) to clear cache.
270
270
3 . Use ` Swipe ` to delete one image item.
271
- 4 . Clear cache and go to detail page to see progressive loading.
271
+ 4 . Pinch gesture (Digital Crown on watchOS, play button on tvOS) to zoom-in detail page image.
272
+ 5 . Clear cache and go to detail page to see progressive loading.
272
273
273
274
## Screenshot
274
275
You can’t perform that action at this time.
0 commit comments