如何在RxSwift中使用CLLocation扩展

时间:2016-11-25 19:25:57

标签: ios swift3 cllocation rx-swift

我希望CLLocationManagerhttps://github.com/ReactiveX/RxSwift/issues/413一样使用RxSwift,但我发现CLLocationManager扩展名已移至RxExample }(这里提到https://github.com/ReactiveX/RxSwift/issues/900)。

我的问题是:如何使用该代码?当我导入RxSwiftRxCocoa时,我无权访问,例如locationManager.rx.didUpdateLocations。我该怎么做才能将CoreLocationRxSwift一起使用?

我正在使用Xcode 8,Swift 3。

提前感谢您的帮助!

更新

我发现现在我们必须复制&从CLLocationManager粘贴RxExample扩展名(详细信息here在该提交的评论中)。

2 个答案:

答案 0 :(得分:2)

您必须将扩展CLLocationManager + Rx.swift和RxCLLocationManagerDelegateProxy.swift复制到您的项目,因为它不再是RxCocoa的一部分

答案 1 :(得分:2)

对于通过Google发现此问题的任何人,Rx Location Manager功能已移至:https://github.com/RxSwiftCommunity/RxCoreLocation,因此不再需要手动复制和粘贴文件。