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 {
4545 }
4646
4747 func zoomView( ) -> some View {
48- #if os(macOS) || os(iOS) || os(tvOS)
48+ #if os(macOS) || os(iOS)
4949 return contentView ( )
5050 . scaleEffect ( self . scale)
51- . gesture ( MagnificationGesture ( minimumScaleDelta: 0.1 ) . onChanged { value in
51+ . gesture ( MagnificationGesture ( minimumScaleDelta: 0.1 ) . onChanged { value in
5252 let delta = value / self . lastScaleValue
5353 self . lastScaleValue = value
5454 let newScale = self . scale * delta
5555 self . scale = min ( max ( newScale, 0.5 ) , 2 )
5656 } . onEnded { value in
5757 self . lastScaleValue = 1.0
5858 } )
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)
6075 return contentView ( )
6176 // SwiftUI's bug workaround (watchOS 6.1)
6277 // 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:
2682681 . Use ` Switch ` (right-click on macOS/force press on watchOS) to switch between ` WebImage ` and ` AnimatedImage ` .
2692692 . Use ` Reload ` (right-click on macOS/force press on watchOS) to clear cache.
2702703 . 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.
272273
273274## Screenshot
274275
You can’t perform that action at this time.
0 commit comments