Swift: 未知属性 ‘Observable’

huangapple go评论56阅读模式
英文:

Swift: Unknown attribute 'Observable'

问题

在 Xcode 15(仍为测试版)中使用 Swift 5.9,我想使用 @Observable 代替

@Observable struct Feature {
    let name: String
}

我收到以下错误:

未知属性 'Observable'
英文:

In Xcode 15 (still beta) with Swift 5.9, I want to use @Observable instead of

@Observable struct Feature {
    let name: String
}

I'm getting the below error:

Unknown attribute 'Observable'

答案1

得分: 3

I had to import Observation framework

我必须导入 Observation 框架

import Observation

英文:

I had to import Observation framework

import Observation

huangapple
  • 本文由 发表于 2023年6月15日 14:59:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76479885.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定