簡體   English   中英

SwiftUI 收到“源文件中的編輯器占位符”和“作為類型的協議‘Equatable’不能符合協議本身”錯誤

[英]SwiftUI receiving "Editor placeholder in source file" and "Protocol 'Equatable' as a type cannot conform to the protocol itself" errors

我正在參加 SwiftUI 課程,並試圖弄清楚這個 animation 方法,但由於某種原因它沒有編譯。

有一段時間沒有使用 swift 進行編碼,有人可以指出我正確的方向嗎?

謝謝

 struct ContentView: View {
private let imageURL: String = "https://credo.academy/credo-academy@3x.png"

var body: some View {

    AsyncImage(url: URL(string: imageURL), transaction: Transaction(animation: .interactiveSpring(response: 0.5, dampingFraction: 0.6, blendDuration: 0.25))) {
        phase in
        switch phase {
        case .success(let image):
            image
                .imageModifier()
                .transition(.move(edge: .bottom))
        case .failure(_):
            Image(systemName: "ant.circle.fill").iconModifier()
        case.empty:
            Image(systemName: "photo.circle.fill").iconModifier()
        @unknown default:
           ProgressView()
        }
    }
    .padding(40)
}
  }

可悲的是,通過重啟 xcode 解決了這個問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM