0

画像が AsyncImage に正常に読み込まれるまで、ビュー全体で .redacted を使用したいと思います..現在、これを完了する方法が見つかりません..私の最後の試みはこれでした..

struct MyView: View { 

        var body: some View { 
           VStack {
                //Other Views
                AsyncImage(url: URL(string: "https://cdn2.thecatapi.com/images/7CGV6WVXq.jpg")!) { phase in 
                  if let image = phase.image  {
                    image
                      //Some image modifiers
                     self.imageLoaded = true // Of course this won't work in this closure but I cannot think of where else to put it. 
                   }

                }
            }.redacted(reason: imageLoaded ? .placeholder : []) // <-- How to redact programmatically?
        }
}
4

1 に答える 1