From c6526e830a8d7b20cbaec86f9c077cbb1e5cba94 Mon Sep 17 00:00:00 2001 From: Krunoslav Zaher Date: Sun, 10 Jan 2016 18:36:43 +0100 Subject: [PATCH] Adds `UIImagePicker` documentation. --- RxCocoa/iOS/UIImagePickerController+Rx.swift | 55 ++++++++++++-------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/RxCocoa/iOS/UIImagePickerController+Rx.swift b/RxCocoa/iOS/UIImagePickerController+Rx.swift index c5c42d25..aa4a3f3f 100644 --- a/RxCocoa/iOS/UIImagePickerController+Rx.swift +++ b/RxCocoa/iOS/UIImagePickerController+Rx.swift @@ -10,32 +10,43 @@ import Foundation #if os(iOS) import Foundation - + #if !RX_NO_MODULE import RxSwift #endif import UIKit - -extension UIImagePickerController { - - public var rx_delegate: DelegateProxy { - return proxyForObject(RxImagePickerDelegateProxy.self, self) + + extension UIImagePickerController { + + /** + Reactive wrapper for `delegate`. + + For more information take a look at `DelegateProxyType` protocol documentation. + */ + public var rx_delegate: DelegateProxy { + return proxyForObject(RxImagePickerDelegateProxy.self, self) + } + + /** + Reactive wrapper for `delegate` message. + */ + public var rx_didFinishPickingMediaWithInfo: Observable<[String : AnyObject]> { + return rx_delegate + .observe("imagePickerController:didFinishPickingMediaWithInfo:") + .map({ (a) in + return try castOrThrow(Dictionary.self, a[1]) + }) + } + + /** + Reactive wrapper for `delegate` message. + */ + public var rx_didCancel: Observable<()> { + return rx_delegate + .observe("imagePickerControllerDidCancel:") + .map {_ in () } + } + } - public var rx_didFinishPickingMediaWithInfo: Observable<[String : AnyObject]> { - return rx_delegate - .observe("imagePickerController:didFinishPickingMediaWithInfo:") - .map({ (a) in - return try castOrThrow(Dictionary.self, a[1]) - }) - } - - public var rx_didCancel: Observable { - return rx_delegate - .observe("imagePickerControllerDidCancel:") - .map({_ in ()}) - } - -} - #endif