// // RxImagePickerDelegateProxy.swift // RxExample // // Created by Segii Shulga on 1/4/16. // Copyright © 2016 Krunoslav Zaher. All rights reserved. // import RxSwift import RxCocoa import UIKit //图片选择控制器(UIImagePickerController)代理委托 public class RxImagePickerDelegateProxy : DelegateProxy, DelegateProxyType, UIImagePickerControllerDelegate, UINavigationControllerDelegate { public init(imagePicker: UIImagePickerController) { super.init(parentObject: imagePicker, delegateProxy: RxImagePickerDelegateProxy.self) } public static func registerKnownImplementations() { self.register { RxImagePickerDelegateProxy(imagePicker: $0) } } public static func currentDelegate(for object: UIImagePickerController) -> (UIImagePickerControllerDelegate & UINavigationControllerDelegate)? { return object.delegate } public static func setCurrentDelegate(_ delegate: (UIImagePickerControllerDelegate & UINavigationControllerDelegate)?, to object: UIImagePickerController) { object.delegate = delegate } }