本文介绍了使用合并的运行时错误:dyld:找不到符号:_ $ s7Combine9PublishedV9PublisherCyx_GAadAMc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Xcode 11 Beta 5(11M382q),并将iphone x与iOS 13 beta 6结合使用,尝试使用Combine时遇到此运行时错误:
I'm using Xcode 11 Beta 5 (11M382q), and iphone x with iOS 13 beta 6 and I am having this runtime error when trying to use Combine:
我有一个Core类,它是一个 ObservableObject
I have a Core class that is an ObservableObject
import SwiftUI
import Combine
open class Core: ObservableObject {
@Published public var userId = ""
public var isUserValid: AnyPublisher<Bool, Never> {
return $userId.debounce(for: 0.5, scheduler: RunLoop.main).removeDuplicates().map { (user: String) in
return user.isEmpty
}.eraseToAnyPublisher()
}
}
一个简单的视图
import SwiftUI
import Combine
struct LoginView: View {
@EnvironmentObject var core: Core
@State var isLoading: Bool = false
@State var submitButtonEnabled: Bool = false
var body: some View {
VStack {
VStack(alignment: .center) {
Image("logo")
.frame(minWidth: Constants.logoWidth, minHeight: Constants.logoHeight, alignment: .center)
.padding(.top, Constants.logoTopPadding)
.animation(.default)
.scaledToFit()
}
}
CircularButton(isLoading: $isLoading, image: Constants.submitButtonArrowImageName) {
// Button Action
}
.padding(.top, Constants.submitButtonTopPadding)
.disabled($submitButtonEnabled.value)
.onReceive(self.core.isUserValid) { value in
self.submitButtonEnabled = value
}
}
}
我的代码有什么问题?我只希望使用反应式编程的MVVM体系结构来禁用或启用按钮.
What's wrong with my code? I Just want a MVVM architecture using reactive programming to disable or enable a button.
推荐答案
我下载了Xcode 11 beta 6,iOS 13 beta 7,现在工作正常.这是先前Beta版本的错误.
I downloaded Xcode 11 beta 6, iOS 13 beta 7 and now is working fine. It was a bug from previous beta versions.
这篇关于使用合并的运行时错误:dyld:找不到符号:_ $ s7Combine9PublishedV9PublisherCyx_GAadAMc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!