-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
RxSearchControllerDelegateProxy.swift
43 lines (35 loc) · 1.3 KB
/
RxSearchControllerDelegateProxy.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// RxSearchControllerDelegateProxy.swift
// RxCocoa
//
// Created by Segii Shulga on 3/17/16.
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
//
#if os(iOS)
#if !RX_NO_MODULE
import RxSwift
#endif
import UIKit
/// For more information take a look at `DelegateProxyType`.
@available(iOS 8.0, *)
public class RxSearchControllerDelegateProxy
: DelegateProxy
, DelegateProxyType
, UISearchControllerDelegate {
/// For more information take a look at `DelegateProxyType`.
public override class func createProxyForObject(_ object: AnyObject) -> AnyObject {
let pickerView: UISearchController = castOrFatalError(object)
return pickerView.createRxDelegateProxy()
}
/// For more information take a look at `DelegateProxyType`.
public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) {
let searchController: UISearchController = castOrFatalError(object)
searchController.delegate = castOptionalOrFatalError(delegate)
}
/// For more information take a look at `DelegateProxyType`.
public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? {
let searchController: UISearchController = castOrFatalError(object)
return searchController.delegate
}
}
#endif