Fix watchOS demo compile issue

This commit is contained in:
DreamPiggy 2022-09-22 00:13:22 +08:00
parent 1d7efeccc4
commit d18693909b
1 changed files with 6 additions and 0 deletions

View File

@ -48,6 +48,11 @@ struct ContentView2: View {
Group {
Text("\(animated ? "AnimatedImage" : "WebImage") - \((imageURLs[imageIndex] as NSString).lastPathComponent)")
Spacer()
#if os(watchOS)
WebImage(url:URL(string: imageURLs[imageIndex]))
.resizable()
.aspectRatio(contentMode: .fit)
#else
if self.animated {
AnimatedImage(url:URL(string: imageURLs[imageIndex]))
.resizable()
@ -57,6 +62,7 @@ struct ContentView2: View {
.resizable()
.aspectRatio(contentMode: .fit)
}
#endif
Spacer()
Button("Next") {
if imageIndex + 1 >= imageURLs.count {