异步图未在Swift Playgrounds 4.1 [Mac]应用程序上加载图像预览
上面发布的URL显示了我似乎无法解决的问题的示例。在Swift Playground的iPad版本上,Asyncimage的使用起作用,但是当我在Swift Playgrounds的Mac Verison上加载相同的代码时,图像预览每次都不会加载。
编辑:此问题仅在图像的远程加载中发生,如果我向项目添加图像,则可以加载良好。
EDIT2:下面的代码段
import SwiftUI
struct ContentView: View {
var body: some View {
Section {
VStack {
AsyncImage(url: URL(string: "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/1200px-Image_created_with_a_mobile_phone.png")) { image in
image
.resizable()
.scaledToFit()
} placeholder: {
Color.red.opacity(1)
}
.frame(width: 200, height: 200)
.cornerRadius(6)
}
}
}
}
The URL posted above shows an example of the problem i can't seem to solve so far. On the ipad version of swift playgrounds the use of Asyncimage works, however when i load the same code on the mac verison of swift playgrounds, the image preview fails to load every time.
Edit: This problem only occurs with the remote loading of images, if i add an image to the project, it loads just fine.
Edit2: Code Snippet Below
import SwiftUI
struct ContentView: View {
var body: some View {
Section {
VStack {
AsyncImage(url: URL(string: "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/1200px-Image_created_with_a_mobile_phone.png")) { image in
image
.resizable()
.scaledToFit()
} placeholder: {
Color.red.opacity(1)
}
.frame(width: 200, height: 200)
.cornerRadius(6)
}
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论