Update the Demo for watchOS, added tooltip

This commit is contained in:
DreamPiggy 2021-02-25 12:39:27 +08:00
parent 532ca91191
commit f4a03dcf23
1 changed files with 4 additions and 0 deletions

View File

@ -17,6 +17,7 @@ class UserSettings: ObservableObject {
#endif #endif
} }
#if os(watchOS)
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *) @available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
extension Indicator where T == ProgressView<EmptyView, EmptyView> { extension Indicator where T == ProgressView<EmptyView, EmptyView> {
static var activity: Indicator { static var activity: Indicator {
@ -31,6 +32,7 @@ extension Indicator where T == ProgressView<EmptyView, EmptyView> {
} }
} }
} }
#endif
struct ContentView: View { struct ContentView: View {
@State var imageURLs = [ @State var imageURLs = [
@ -143,6 +145,7 @@ struct ContentView: View {
.transition(.fade(duration: 0.5)) .transition(.fade(duration: 0.5))
.scaledToFit() .scaledToFit()
.frame(width: CGFloat(100), height: CGFloat(100), alignment: .center) .frame(width: CGFloat(100), height: CGFloat(100), alignment: .center)
.help(url)
#endif #endif
} else { } else {
WebImage(url: URL(string:url), isAnimating: .constant(true)) WebImage(url: URL(string:url), isAnimating: .constant(true))
@ -156,6 +159,7 @@ struct ContentView: View {
.transition(.fade(duration: 0.5)) .transition(.fade(duration: 0.5))
.scaledToFit() .scaledToFit()
.frame(width: CGFloat(100), height: CGFloat(100), alignment: .center) .frame(width: CGFloat(100), height: CGFloat(100), alignment: .center)
.help(url)
} }
Text((url as NSString).lastPathComponent) Text((url as NSString).lastPathComponent)
} }