如何在 RxSwift 中使用 CLLocation 扩展
How to use CLLocation extension in RxSwift
我想将 CLLocationManager
与 RxSwift
一起使用,就像在
https://github.com/ReactiveX/RxSwift/issues/413
but I found that CLLocationManager
extension was moved to RxExample
(mentioned here https://github.com/ReactiveX/RxSwift/issues/900 中一样)。
我的问题是:如何使用该代码?当我导入 RxSwift
和 RxCocoa
时,我无权访问例如locationManager.rx.didUpdateLocations
。我应该怎么做才能将 CoreLocation
与 RxSwift
一起使用?
我正在使用 Xcode 8,Swift 3.
在此先感谢您的帮助!
更新
我发现建议我们现在必须从 RxExample
复制并粘贴 CLLocationManager
扩展(详细信息 here 在该提交的评论中)。
您必须将扩展 CLLocationManager+Rx.swift 和 RxCLLocationManagerDelegateProxy.swift 复制到您的项目中,因为它不再是 RxCocoa 的一部分
对于通过 Google 找到此内容的任何人,Rx 位置管理器功能已移至:https://github.com/RxSwiftCommunity/RxCoreLocation 因此不再需要手动复制和粘贴文件。
我想将 CLLocationManager
与 RxSwift
一起使用,就像在
https://github.com/ReactiveX/RxSwift/issues/413
but I found that CLLocationManager
extension was moved to RxExample
(mentioned here https://github.com/ReactiveX/RxSwift/issues/900 中一样)。
我的问题是:如何使用该代码?当我导入 RxSwift
和 RxCocoa
时,我无权访问例如locationManager.rx.didUpdateLocations
。我应该怎么做才能将 CoreLocation
与 RxSwift
一起使用?
我正在使用 Xcode 8,Swift 3.
在此先感谢您的帮助!
更新
我发现建议我们现在必须从 RxExample
复制并粘贴 CLLocationManager
扩展(详细信息 here 在该提交的评论中)。
您必须将扩展 CLLocationManager+Rx.swift 和 RxCLLocationManagerDelegateProxy.swift 复制到您的项目中,因为它不再是 RxCocoa 的一部分
对于通过 Google 找到此内容的任何人,Rx 位置管理器功能已移至:https://github.com/RxSwiftCommunity/RxCoreLocation 因此不再需要手动复制和粘贴文件。