找不到合并@Published-Xcode11 Beta 5(11M382q)

时间:2019-08-13 15:53:51

标签: ios swift xcode ios13 combine

我正在尝试使用以下内容运行一个简单的项目:

@Published var currentPlacemark: CLPlacemark? = nil

  • XCode11 Beta5(11M382q)
  • iOS13(17A5556d)

出现以下错误: dyld: Symbol not found: _$s7Combine9PublishedV9PublisherCyx_GAadAM

还有其他人遇到过吗?

代码示例:

import SwiftUI
import Combine

class MyFoo {
  @Published var bar: String = ""
}

struct ContentView: View {
    var body: some View {
        Text("Hello World")
    }
}

#if DEBUG
struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        let foo = MyFoo()
      foo.bar = "asas"
        let barSink = foo.$bar
            .sink() {
                print("bar value: \($0)")
        }
        return ContentView()
    }
}
#endif

1 个答案:

答案 0 :(得分:1)

这是您提到的版本的错误,我遇到了同样的问题。要解决此问题,请更新到新的Beta:

  • Xcode 11 beta 6(11M392q)
  • iOS 13 beta 7(17A5565b)