RxOrientation
RxOrientation是RxSwift的一个屏幕方向通知扩展,它将屏幕方向通知的状态转换为RxSwift的Observables。
示例
要运行示例项目,请克隆仓库,然后从Example目录首先运行pod install
。
安装
RxOrientation可通过CocoaPods获取。要安装它,只需将以下行添加到您的Podfile中
pod 'RxOrientation'
在您的视图模型类或视图控制器类中使用UIDevice.current.rx.orientation
来获取当前设备方向,并使用UIApplication.shared.rx.statusBarOrientation
来获取状态栏方向。
UIApplication.shared.rx.statusBarOrientation.subscribe(onNext: { orientaion in
// ...
}).disposed(by: disposeBag)
作者
lm2343635, [email protected]
许可证
RxOrientation 可在 MIT 许可下使用。有关更多信息,请参阅 LICENSE 文件。