gpt4 book ai didi

swift - ReactiveCocoa 5.0 中的 "startWith"发生了什么?

转载 作者:行者123 更新时间:2023-11-28 15:56:45 25 4
gpt4 key购买 nike

有人知道“startWith”函数变成了什么吗?

我尝试使用一本适用于 4.x 版本的书来学习 reactivecocoa。该示例使用 startWith 为 datePicker 控件强制赋值。

最佳答案

现在有版本 startWithValues, startWithFailed, startWithCompletedstartWithInterrupted 在你只关心的情况下一种特定类型的事件。

如果您需要更多或所有事件,请使用带有Observer 和事件切换的版本start

producer.start { event in
switch event {
case let .value(value):
// Handle value
case let .failed(err):
// Handle error
case .completed:
// Handle completed
case .interrupted:
// Handle interrupted
}
}

关于swift - ReactiveCocoa 5.0 中的 "startWith"发生了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41620100/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com