several fixes and example
- CLLocationManager+Rx fixed - UIDatePicker+Rx fixed - RxExaples added
This commit is contained in:
parent
07ee6bf77e
commit
1bc5db4f5d
|
|
@ -27,7 +27,7 @@
|
|||
C83111711B491C9F001F3D67 /* KVOObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83111701B491C9F001F3D67 /* KVOObservable.swift */; };
|
||||
C83111721B491C9F001F3D67 /* KVOObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83111701B491C9F001F3D67 /* KVOObservable.swift */; };
|
||||
C83225451B1A9ACC0048EC77 /* UIBarButtonItem+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83225441B1A9ACC0048EC77 /* UIBarButtonItem+Rx.swift */; };
|
||||
C83225471B1A9CCB0048EC77 /* UIDatePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83225461B1A9CCB0048EC77 /* UIDatePicker.swift */; };
|
||||
C83225471B1A9CCB0048EC77 /* UIDatePicker+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83225461B1A9CCB0048EC77 /* UIDatePicker+Rx.swift */; };
|
||||
C83225491B1A9ECC0048EC77 /* NSControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83225481B1A9ECC0048EC77 /* NSControl+Rx.swift */; };
|
||||
C83CF8631B3DDD54001359E7 /* RxTableViewReactiveArrayDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83CF8621B3DDD54001359E7 /* RxTableViewReactiveArrayDataSource.swift */; };
|
||||
C84969CA1B47DE1D00E0BDB9 /* RxCollectionViewDataSourceProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C84969C51B47DE1D00E0BDB9 /* RxCollectionViewDataSourceProxy.swift */; };
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
C81553E31A98AB4A00C63152 /* RxCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RxCocoa.h; sourceTree = "<group>"; };
|
||||
C83111701B491C9F001F3D67 /* KVOObservable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KVOObservable.swift; sourceTree = "<group>"; };
|
||||
C83225441B1A9ACC0048EC77 /* UIBarButtonItem+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIBarButtonItem+Rx.swift"; sourceTree = "<group>"; };
|
||||
C83225461B1A9CCB0048EC77 /* UIDatePicker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIDatePicker.swift; sourceTree = "<group>"; };
|
||||
C83225461B1A9CCB0048EC77 /* UIDatePicker+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIDatePicker+Rx.swift"; sourceTree = "<group>"; };
|
||||
C83225481B1A9ECC0048EC77 /* NSControl+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSControl+Rx.swift"; sourceTree = "<group>"; };
|
||||
C83CF8621B3DDD54001359E7 /* RxTableViewReactiveArrayDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxTableViewReactiveArrayDataSource.swift; sourceTree = "<group>"; };
|
||||
C84969C51B47DE1D00E0BDB9 /* RxCollectionViewDataSourceProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxCollectionViewDataSourceProxy.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -275,7 +275,7 @@
|
|||
C88BB8E01B07F2BE0064D411 /* UIButton+Rx.swift */,
|
||||
C88BB8E11B07F2BE0064D411 /* UICollectionView+Rx.swift */,
|
||||
653C8BF31B114EB600983087 /* UIControl+Rx.swift */,
|
||||
C83225461B1A9CCB0048EC77 /* UIDatePicker.swift */,
|
||||
C83225461B1A9CCB0048EC77 /* UIDatePicker+Rx.swift */,
|
||||
C88BB8E21B07F2BE0064D411 /* UIImageView+Rx.swift */,
|
||||
C88BB8E31B07F2BE0064D411 /* UILabel+Rx.swift */,
|
||||
C88BB8E41B07F2BE0064D411 /* UIScrollView+Rx.swift */,
|
||||
|
|
@ -447,7 +447,7 @@
|
|||
C862823D1B36037100500DC3 /* NSNotificationCenter+Rx.swift in Sources */,
|
||||
C84969CE1B47DE1D00E0BDB9 /* RxTableViewDelegateProxy.swift in Sources */,
|
||||
C86282501B370C7E00500DC3 /* ItemEvents.swift in Sources */,
|
||||
C83225471B1A9CCB0048EC77 /* UIDatePicker.swift in Sources */,
|
||||
C83225471B1A9CCB0048EC77 /* UIDatePicker+Rx.swift in Sources */,
|
||||
C83225451B1A9ACC0048EC77 /* UIBarButtonItem+Rx.swift in Sources */,
|
||||
075F130C1B4DD100000D7861 /* UISegmentedControl+Rx.swift in Sources */,
|
||||
075F13001B4DD075000D7861 /* RxAlertViewDelegateProxy.swift in Sources */,
|
||||
|
|
|
|||
|
|
@ -19,24 +19,24 @@ extension CLLocationManager {
|
|||
|
||||
// MARK: Responding to Location Events
|
||||
|
||||
public var rx_didUpdateLocations: Observable<[AnyObject]> {
|
||||
public var rx_didUpdateLocations: Observable<[CLLocation]!> {
|
||||
return rx_delegate.observe("locationManager:didUpdateLocations:")
|
||||
>- map { a in
|
||||
return a[1] as! [AnyObject]
|
||||
return a[1] as! [CLLocation]
|
||||
}
|
||||
}
|
||||
|
||||
public var rx_didFailWithError: Observable<NSError> {
|
||||
public var rx_didFailWithError: Observable<NSError!> {
|
||||
return rx_delegate.observe("locationManager:didFailWithError:")
|
||||
>- map { a in
|
||||
return a[1] as! NSError
|
||||
return a[1] as? NSError
|
||||
}
|
||||
}
|
||||
|
||||
public var rx_didFinishDeferredUpdatesWithError: Observable<NSError> {
|
||||
public var rx_didFinishDeferredUpdatesWithError: Observable<NSError!> {
|
||||
return rx_delegate.observe("locationManager:didFinishDeferredUpdatesWithError:")
|
||||
>- map { a in
|
||||
return a[1] as! NSError
|
||||
return a[1] as? NSError
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -58,10 +58,10 @@ extension CLLocationManager {
|
|||
|
||||
// MARK: Responding to Heading Events
|
||||
|
||||
public var rx_didUpdateHeading: Observable<CLHeading> {
|
||||
public var rx_didUpdateHeading: Observable<CLHeading!> {
|
||||
return rx_delegate.observe("locationManager:didUpdateHeading:")
|
||||
>- map { a in
|
||||
return a[1] as! CLHeading
|
||||
return a[1] as? CLHeading
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -74,63 +74,63 @@ extension CLLocationManager {
|
|||
|
||||
// MARK: Responding to Region Events
|
||||
|
||||
public var rx_didEnterRegion: Observable<CLRegion> {
|
||||
public var rx_didEnterRegion: Observable<CLRegion!> {
|
||||
return rx_delegate.observe("locationManager:didEnterRegion:")
|
||||
>- map { a in
|
||||
return a[1] as! CLRegion
|
||||
return a[1] as? CLRegion
|
||||
}
|
||||
}
|
||||
|
||||
public var rx_didExitRegion: Observable<CLRegion> {
|
||||
public var rx_didExitRegion: Observable<CLRegion!> {
|
||||
return rx_delegate.observe("locationManager:didExitRegion:")
|
||||
>- map { a in
|
||||
return a[1] as! CLRegion
|
||||
return a[1] as? CLRegion
|
||||
}
|
||||
}
|
||||
|
||||
public var rx_didDetermineStateForRegion: Observable<(state: CLRegionState, region: CLRegion)> {
|
||||
public var rx_didDetermineStateForRegion: Observable<(state: CLRegionState, region: CLRegion!)> {
|
||||
return rx_delegate.observe("locationManager:didDetermineState:forRegion:")
|
||||
>- map { a in
|
||||
return (state: a[1] as! CLRegionState, region: a[2] as! CLRegion)
|
||||
return (state: a[1] as! CLRegionState, region: a[2] as? CLRegion)
|
||||
}
|
||||
}
|
||||
|
||||
public var rx_monitoringDidFailForRegionWithError: Observable<(region: CLRegion, error: NSError)> {
|
||||
public var rx_monitoringDidFailForRegionWithError: Observable<(region: CLRegion!, error: NSError!)> {
|
||||
return rx_delegate.observe("locationManager:monitoringDidFailForRegion:withError:")
|
||||
>- map { a in
|
||||
return (region: a[1] as! CLRegion, error: a[2] as! NSError)
|
||||
return (region: a[1] as? CLRegion, error: a[2] as? NSError)
|
||||
}
|
||||
}
|
||||
|
||||
public var rx_didStartMonitoringForRegion: Observable<CLRegion> {
|
||||
public var rx_didStartMonitoringForRegion: Observable<CLRegion!> {
|
||||
return rx_delegate.observe("locationManager:didStartMonitoringForRegion:")
|
||||
>- map { a in
|
||||
return a[1] as! CLRegion
|
||||
return a[1] as? CLRegion
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Responding to Ranging Events
|
||||
|
||||
public var rx_didRangeBeaconsInRegion: Observable<(beacons: [AnyObject], region: CLBeaconRegion)> {
|
||||
public var rx_didRangeBeaconsInRegion: Observable<(beacons: [CLBeacon]!, region: CLBeaconRegion!)> {
|
||||
return rx_delegate.observe("locationManager:didRangeBeacons:inRegion:")
|
||||
>- map { a in
|
||||
return (beacons: a[1] as! [AnyObject], region: a[2] as! CLBeaconRegion)
|
||||
return (beacons: a[1] as? [CLBeacon], region: a[2] as? CLBeaconRegion)
|
||||
}
|
||||
}
|
||||
|
||||
public var rx_rangingBeaconsDidFailForRegionWithError: Observable<(region: CLBeaconRegion, error: NSError)> {
|
||||
public var rx_rangingBeaconsDidFailForRegionWithError: Observable<(region: CLBeaconRegion!, error: NSError!)> {
|
||||
return rx_delegate.observe("locationManager:rangingBeaconsDidFailForRegion:withError:")
|
||||
>- map { a in
|
||||
return (region: a[1] as! CLBeaconRegion, error: a[2] as! NSError)
|
||||
return (region: a[1] as? CLBeaconRegion, error: a[2] as? NSError)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Responding to Visit Events
|
||||
|
||||
public var rx_didVisit: Observable<CLVisit> {
|
||||
public var rx_didVisit: Observable<CLVisit!> {
|
||||
return rx_delegate.observe("locationManager:didVisit:")
|
||||
>- map { a in
|
||||
return a[1] as! CLVisit
|
||||
return a[1] as? CLVisit
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
//
|
||||
// UIDatePicker.swift
|
||||
// RxCocoa
|
||||
//
|
||||
// Created by Daniel Tartaglia on 5/31/15.
|
||||
// Modified by Carlos García on 7/9/15.
|
||||
// Copyright (c) 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
import Foundation
|
||||
import RxSwift
|
||||
import UIKit
|
||||
|
||||
extension UIDatePicker {
|
||||
|
||||
public var rx_date: Observable<NSDate> {
|
||||
return AnonymousObservable { observer in
|
||||
|
||||
sendNext(observer, self.date)
|
||||
|
||||
let controlTarget = ControlTarget(control: self, controlEvents: UIControlEvents.ValueChanged) { control in
|
||||
sendNext(observer, (control as! UIDatePicker).date)
|
||||
}
|
||||
|
||||
return AnonymousDisposable {
|
||||
controlTarget.dispose()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
//
|
||||
// UIDatePicker.swift
|
||||
// RxCocoa
|
||||
//
|
||||
// Created by Daniel Tartaglia on 5/31/15.
|
||||
// Copyright (c) 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
import Foundation
|
||||
import RxSwift
|
||||
import UIKit
|
||||
|
||||
extension UIDatePicker {
|
||||
|
||||
public var rx_date: Observable<NSDate> {
|
||||
return rx_value { [weak self] in self?.date ?? NSDate() }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@
|
|||
0706E19B1B17361100BA2D3A /* UIImageView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0706E19A1B17361100BA2D3A /* UIImageView+Extensions.swift */; };
|
||||
0706E19D1B176EE200BA2D3A /* String+extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0706E19C1B176EE200BA2D3A /* String+extensions.swift */; };
|
||||
0706E19F1B17703E00BA2D3A /* RandomUserAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0706E19E1B17703E00BA2D3A /* RandomUserAPI.swift */; };
|
||||
075F13101B4E9D5A000D7861 /* APIWrappersViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 075F130F1B4E9D5A000D7861 /* APIWrappersViewController.swift */; };
|
||||
07E300071B14995F00F00100 /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07E300061B14995F00F00100 /* TableViewController.swift */; };
|
||||
07E300091B149A2A00F00100 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07E300081B149A2A00F00100 /* User.swift */; };
|
||||
07E3C2331B03605B0010338D /* Dependencies.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07E3C2321B03605B0010338D /* Dependencies.swift */; };
|
||||
|
|
@ -110,6 +111,7 @@
|
|||
0706E19A1B17361100BA2D3A /* UIImageView+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImageView+Extensions.swift"; sourceTree = "<group>"; };
|
||||
0706E19C1B176EE200BA2D3A /* String+extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+extensions.swift"; sourceTree = "<group>"; };
|
||||
0706E19E1B17703E00BA2D3A /* RandomUserAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RandomUserAPI.swift; sourceTree = "<group>"; };
|
||||
075F130F1B4E9D5A000D7861 /* APIWrappersViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = APIWrappersViewController.swift; sourceTree = "<group>"; };
|
||||
07E300061B14995F00F00100 /* TableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableViewController.swift; sourceTree = "<group>"; };
|
||||
07E300081B149A2A00F00100 /* User.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = "<group>"; };
|
||||
07E3C2321B03605B0010338D /* Dependencies.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Dependencies.swift; path = Examples/Dependencies.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -213,14 +215,23 @@
|
|||
name = UIKitExtensions;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
07E300051B14994500F00100 /* 04 TableView */ = {
|
||||
075F130E1B4E9D10000D7861 /* 04 APIWrappers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
075F130F1B4E9D5A000D7861 /* APIWrappersViewController.swift */,
|
||||
);
|
||||
name = "04 APIWrappers";
|
||||
path = APIWrappers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
07E300051B14994500F00100 /* 05 TableView */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0706E1A01B1770C800BA2D3A /* RandomUserAPI */,
|
||||
0706E1A11B1770D300BA2D3A /* Controllers */,
|
||||
0706E1A21B1770E200BA2D3A /* UIKitExtensions */,
|
||||
);
|
||||
name = "04 TableView";
|
||||
name = "05 TableView";
|
||||
path = TableView;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
|
|
@ -281,14 +292,14 @@
|
|||
path = Services;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C859B9A21B45C5D900D012D7 /* 05 PartialUpdates */ = {
|
||||
C859B9A21B45C5D900D012D7 /* 06 PartialUpdates */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C859B9A31B45C5D900D012D7 /* PartialUpdatesViewController.swift */,
|
||||
C859B9AB1B45CF9100D012D7 /* NumberCell.swift */,
|
||||
C859B9AD1B45CFAB00D012D7 /* NumberSectionView.swift */,
|
||||
);
|
||||
name = "05 PartialUpdates";
|
||||
name = "06 PartialUpdates";
|
||||
path = PartialUpdates;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
|
|
@ -298,8 +309,9 @@
|
|||
C8DF92F41B0B4392009BCF9A /* 01 Introduction */,
|
||||
C86E2F4C1AE5A10900C31024 /* 02 GitHubSignup */,
|
||||
C86E2F301AE5A0CA00C31024 /* 03 WikipediaImageSearch */,
|
||||
07E300051B14994500F00100 /* 04 TableView */,
|
||||
C859B9A21B45C5D900D012D7 /* 05 PartialUpdates */,
|
||||
075F130E1B4E9D10000D7861 /* 04 APIWrappers */,
|
||||
07E300051B14994500F00100 /* 05 TableView */,
|
||||
C859B9A21B45C5D900D012D7 /* 06 PartialUpdates */,
|
||||
C8A57F711B40AF4E00D5570A /* 06 CoreData */,
|
||||
);
|
||||
path = Examples;
|
||||
|
|
@ -554,6 +566,7 @@
|
|||
C8C46DAA1B47F7110020D71E /* WikipediaSearchCell.swift in Sources */,
|
||||
C890A6581AEBD26B00AFF7E6 /* GitHubSignupViewController.swift in Sources */,
|
||||
C8A57F741B40AF7C00D5570A /* Random.xcdatamodeld in Sources */,
|
||||
075F13101B4E9D5A000D7861 /* APIWrappersViewController.swift in Sources */,
|
||||
C88C786F1B3EB0A00061C5AB /* RxTableViewSectionedReloadDataSource.swift in Sources */,
|
||||
C859B9AA1B45CB0900D012D7 /* RxCollectionViewSectionedAnimatedDataSource.swift in Sources */,
|
||||
C83367311AD029AE00C668A7 /* Wireframe.swift in Sources */,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,189 @@
|
|||
//
|
||||
// APIWrappersViewController.swift
|
||||
// RxExample
|
||||
//
|
||||
// Created by Carlos García on 8/7/15.
|
||||
// Copyright (c) 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import RxSwift
|
||||
import RxCocoa
|
||||
import CoreLocation
|
||||
|
||||
class APIWrappersViewController: UIViewController {
|
||||
|
||||
@IBOutlet weak var bbitem: UIBarButtonItem!
|
||||
|
||||
@IBOutlet weak var segmentedControl: UISegmentedControl!
|
||||
|
||||
@IBOutlet weak var switcher: UISwitch!
|
||||
|
||||
@IBOutlet weak var button: UIButton!
|
||||
|
||||
@IBOutlet weak var slider: UISlider!
|
||||
|
||||
@IBOutlet weak var textField: UITextField!
|
||||
|
||||
@IBOutlet weak var datePicker: UIDatePicker!
|
||||
|
||||
@IBOutlet weak var mypan: UIPanGestureRecognizer!
|
||||
|
||||
let disposeBag = DisposeBag()
|
||||
|
||||
let manager = CLLocationManager()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
let ash = UIActionSheet(title: "Title", delegate: nil, cancelButtonTitle: "Cancel", destructiveButtonTitle: "OK")
|
||||
let av = UIAlertView(title: "Title", message: "The message", delegate: nil, cancelButtonTitle: "Cancel", otherButtonTitles: "OK", "Two", "Three", "Four", "Five")
|
||||
|
||||
// MARK: UIActionSheet
|
||||
|
||||
ash.rx_clickedButtonAtIndex
|
||||
>- subscribeNext { x in
|
||||
println("UIActionSheet clickedButtonAtIndex \(x)")
|
||||
}
|
||||
>- disposeBag.addDisposable
|
||||
|
||||
ash.rx_willDismissWithButtonIndex
|
||||
>- subscribeNext { x in
|
||||
println("UIActionSheet willDismissWithButtonIndex \(x)")
|
||||
}
|
||||
>- disposeBag.addDisposable
|
||||
|
||||
ash.rx_didDismissWithButtonIndex
|
||||
>- subscribeNext { x in
|
||||
println("UIActionSheet didDismissWithButtonIndex \(x)")
|
||||
|
||||
av.show()
|
||||
}
|
||||
>- disposeBag.addDisposable
|
||||
|
||||
|
||||
// MARK: UIAlertView
|
||||
|
||||
av.rx_clickedButtonAtIndex
|
||||
>- subscribeNext { x in
|
||||
println("UIAlertView clickedButtonAtIndex \(x)")
|
||||
}
|
||||
>- disposeBag.addDisposable
|
||||
|
||||
av.rx_willDismissWithButtonIndex
|
||||
>- subscribeNext { x in
|
||||
println("UIAlertView willDismissWithButtonIndex \(x)")
|
||||
}
|
||||
>- disposeBag.addDisposable
|
||||
|
||||
av.rx_didDismissWithButtonIndex
|
||||
>- subscribeNext { x in
|
||||
println("UIAlertView didDismissWithButtonIndex \(x)")
|
||||
}
|
||||
>- disposeBag.addDisposable
|
||||
|
||||
|
||||
|
||||
|
||||
ash.showInView(view)
|
||||
|
||||
|
||||
// MARK: UIBarButtonItem
|
||||
|
||||
bbitem.rx_tap
|
||||
>- subscribeNext { x in
|
||||
println("UIBarButtonItem Tapped")
|
||||
}
|
||||
>- disposeBag.addDisposable
|
||||
|
||||
// MARK: UISegmentedControl
|
||||
|
||||
segmentedControl.rx_value
|
||||
>- subscribeNext { x in
|
||||
println("UISegmentedControl value \(x)")
|
||||
}
|
||||
>- disposeBag.addDisposable
|
||||
|
||||
|
||||
// MARK: UISwitch
|
||||
|
||||
switcher.rx_value
|
||||
>- subscribeNext { x in
|
||||
println("UISwitch value \(x)")
|
||||
}
|
||||
>- disposeBag.addDisposable
|
||||
|
||||
|
||||
// MARK: UIButton
|
||||
|
||||
button.rx_tap
|
||||
>- subscribeNext { x in
|
||||
println("UIButton Tapped")
|
||||
}
|
||||
>- disposeBag.addDisposable
|
||||
|
||||
|
||||
// MARK: UISlider
|
||||
|
||||
slider.rx_value
|
||||
>- subscribeNext { x in
|
||||
println("UISlider value \(x)")
|
||||
}
|
||||
>- disposeBag.addDisposable
|
||||
|
||||
|
||||
// MARK: UIDatePicker
|
||||
|
||||
datePicker.rx_date
|
||||
>- subscribeNext { x in
|
||||
println("UIDatePicker date \(x)")
|
||||
}
|
||||
>- disposeBag.addDisposable
|
||||
|
||||
|
||||
// MARK: UITextField
|
||||
|
||||
textField.rx_text
|
||||
>- subscribeNext { x in
|
||||
println("UITextField text \(x)")
|
||||
self.textField.resignFirstResponder()
|
||||
}
|
||||
>- disposeBag.addDisposable
|
||||
|
||||
|
||||
// MARK: UIGestureRecognizer
|
||||
|
||||
mypan.rx_event
|
||||
>- subscribeNext { x in
|
||||
println("UIGestureRecognizer event \(x)")
|
||||
}
|
||||
>- disposeBag.addDisposable
|
||||
|
||||
|
||||
// MARK: CLLocationManager
|
||||
|
||||
|
||||
manager.requestWhenInUseAuthorization()
|
||||
|
||||
manager.rx_didUpdateLocations
|
||||
>- subscribeNext { x in
|
||||
println("rx_didUpdateLocations \(x)")
|
||||
}
|
||||
>- disposeBag.addDisposable
|
||||
|
||||
manager.rx_didFailWithError
|
||||
>- subscribeNext { x in
|
||||
println("rx_didFailWithError \(x)")
|
||||
}
|
||||
>- disposeBag.addDisposable
|
||||
|
||||
|
||||
manager.startUpdatingLocation()
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -22,6 +22,8 @@
|
|||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSLocationAlwaysUsageDescription</key>
|
||||
<string>We need location</string>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="yYr-Cu-KXe" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-245" y="1640"/>
|
||||
<point key="canvasLocation" x="151" y="272"/>
|
||||
</scene>
|
||||
<!--Detail View Controller-->
|
||||
<scene sceneID="n26-Ac-tgu">
|
||||
|
|
@ -120,7 +120,7 @@
|
|||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="NGu-t4-MLa" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="199" y="1640"/>
|
||||
<point key="canvasLocation" x="595" y="272"/>
|
||||
</scene>
|
||||
<!--GitHub Signup-->
|
||||
<scene sceneID="N2N-1B-sZ4">
|
||||
|
|
@ -223,7 +223,7 @@
|
|||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="3y6-mR-ROv" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="125" y="923"/>
|
||||
<point key="canvasLocation" x="151" y="-1035"/>
|
||||
</scene>
|
||||
<!--Partial Updates View Controller-->
|
||||
<scene sceneID="7Pq-0W-ati">
|
||||
|
|
@ -238,15 +238,15 @@
|
|||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="hUq-CB-rKx" userLabel="partial">
|
||||
<rect key="frame" x="0.0" y="0.0" width="106.5" height="568"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="107" height="568"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</tableView>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="6z9-hh-u3N" userLabel="fullreload">
|
||||
<rect key="frame" x="106" y="64" width="106.5" height="504"/>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" misplaced="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="6z9-hh-u3N" userLabel="fullreload">
|
||||
<rect key="frame" x="106" y="64" width="107" height="504"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</tableView>
|
||||
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="hob-nw-Jrs">
|
||||
<rect key="frame" x="212.5" y="64" width="107.5" height="504"/>
|
||||
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" misplaced="YES" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="hob-nw-Jrs">
|
||||
<rect key="frame" x="213" y="64" width="108" height="504"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="m51-be-PcL">
|
||||
<size key="itemSize" width="55" height="35"/>
|
||||
|
|
@ -262,8 +262,8 @@
|
|||
<rect key="frame" x="0.0" y="0.0" width="55" height="35"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vIm-V4-xJI">
|
||||
<rect key="frame" x="6.5" y="7.5" width="42" height="20.5"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vIm-V4-xJI">
|
||||
<rect key="frame" x="7" y="8" width="42" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
|
|
@ -284,8 +284,8 @@
|
|||
<rect key="frame" x="0.0" y="0.0" width="107.5" height="25"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Dob-Ct-qBk">
|
||||
<rect key="frame" x="33" y="2.5" width="42" height="20.5"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Dob-Ct-qBk">
|
||||
<rect key="frame" x="33" y="3" width="42" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.98431372549999996" green="0.98431372549999996" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
|
|
@ -334,7 +334,7 @@
|
|||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iOF-ih-lLu" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-789" y="815"/>
|
||||
<point key="canvasLocation" x="133" y="1629"/>
|
||||
</scene>
|
||||
<!--Rx Examples-->
|
||||
<scene sceneID="TnT-xx-y5Q">
|
||||
|
|
@ -416,6 +416,29 @@
|
|||
<segue destination="bZo-ey-Nha" kind="push" id="S82-xv-fWe"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="siT-mr-b8A" detailTextLabel="BSH-sG-bpY" style="IBUITableViewCellStyleSubtitle" id="VBq-7j-4vQ">
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="VBq-7j-4vQ" id="m7h-NW-UnD">
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="API wrappers" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="siT-mr-b8A">
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="API wrappers Example" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="BSH-sG-bpY">
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="11"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<segue destination="J6V-0T-aRq" kind="push" id="jyD-mL-MWs"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
<tableViewSection headerTitle="iPad Examples" footerTitle="Showcase examples for Rx. You can easily test for proper resource cleanup during popping of the navigation stack" id="dLK-dJ-eIx">
|
||||
|
|
@ -455,7 +478,7 @@
|
|||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Bt6-Sf-4JF" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-342.39999999999998" y="171.34666666666666"/>
|
||||
<point key="canvasLocation" x="-397" y="75"/>
|
||||
</scene>
|
||||
<!--Search Wikipedia-->
|
||||
<scene sceneID="W3v-Hb-gUk">
|
||||
|
|
@ -510,7 +533,93 @@ This is only showcase app, not intended for production purposes.</string>
|
|||
</connections>
|
||||
</searchDisplayController>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="158" y="167"/>
|
||||
<point key="canvasLocation" x="151" y="-379"/>
|
||||
</scene>
|
||||
<!--Wrappers View Controller-->
|
||||
<scene sceneID="GYg-hz-8N5">
|
||||
<objects>
|
||||
<viewController id="J6V-0T-aRq" customClass="APIWrappersViewController" customModule="RxExample" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="anJ-3z-vFC"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="bgd-ny-eho"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="wXQ-4H-OJk">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<segmentedControl opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="UpX-Bf-ZT6">
|
||||
<rect key="frame" x="16" y="85" width="123" height="29"/>
|
||||
<segments>
|
||||
<segment title="First"/>
|
||||
<segment title="Second"/>
|
||||
</segments>
|
||||
</segmentedControl>
|
||||
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="WB2-p2-bYm">
|
||||
<rect key="frame" x="14" y="124" width="292" height="31"/>
|
||||
</slider>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QsG-uN-yAh">
|
||||
<rect key="frame" x="147" y="85" width="51" height="31"/>
|
||||
</switch>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0br-EX-AUP">
|
||||
<rect key="frame" x="204" y="85" width="46" height="30"/>
|
||||
<state key="normal" title="TapMe">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
</button>
|
||||
<datePicker contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" datePickerMode="dateAndTime" minuteInterval="1" translatesAutoresizingMaskIntoConstraints="NO" id="JEV-nj-tQA">
|
||||
<rect key="frame" x="16" y="162" width="288" height="162"/>
|
||||
<date key="date" timeIntervalSinceReferenceDate="458137679.98291397">
|
||||
<!--2015-07-09 12:27:59 +0000-->
|
||||
</date>
|
||||
</datePicker>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Eas-vY-Wds">
|
||||
<rect key="frame" x="258" y="86" width="46" height="30"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gjR-nX-oAX">
|
||||
<rect key="frame" x="16" y="332" width="288" height="116"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Test Pan gesture in this view" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fQw-v9-hRf">
|
||||
<rect key="frame" x="35" y="47" width="218" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<gestureRecognizers/>
|
||||
<connections>
|
||||
<outletCollection property="gestureRecognizers" destination="Shn-qP-Kjy" appends="YES" id="3n5-2m-td7"/>
|
||||
</connections>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<gestureRecognizers/>
|
||||
<constraints>
|
||||
<constraint firstItem="WB2-p2-bYm" firstAttribute="trailing" secondItem="wXQ-4H-OJk" secondAttribute="trailingMargin" id="bhR-hJ-vQh"/>
|
||||
<constraint firstItem="WB2-p2-bYm" firstAttribute="leading" secondItem="wXQ-4H-OJk" secondAttribute="leadingMargin" id="gkz-kY-Bej"/>
|
||||
<constraint firstItem="WB2-p2-bYm" firstAttribute="top" secondItem="wXQ-4H-OJk" secondAttribute="topMargin" constant="124" id="xVe-Ni-yEy"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" id="jLb-0R-htG">
|
||||
<barButtonItem key="rightBarButtonItem" title="TapMe" id="PtG-IX-ax4"/>
|
||||
</navigationItem>
|
||||
<connections>
|
||||
<outlet property="bbitem" destination="PtG-IX-ax4" id="Sl6-M4-8r0"/>
|
||||
<outlet property="button" destination="0br-EX-AUP" id="6RQ-bH-oin"/>
|
||||
<outlet property="datePicker" destination="JEV-nj-tQA" id="LdZ-qr-RIy"/>
|
||||
<outlet property="mypan" destination="Shn-qP-Kjy" id="sbA-Xi-VQW"/>
|
||||
<outlet property="segmentedControl" destination="UpX-Bf-ZT6" id="QKf-Ut-0ah"/>
|
||||
<outlet property="slider" destination="WB2-p2-bYm" id="XV2-ty-qzT"/>
|
||||
<outlet property="switcher" destination="QsG-uN-yAh" id="wpt-IK-hWW"/>
|
||||
<outlet property="textField" destination="Eas-vY-Wds" id="BNs-ed-K9u"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="k4I-9E-5OJ" sceneMemberID="firstResponder"/>
|
||||
<panGestureRecognizer minimumNumberOfTouches="1" id="Shn-qP-Kjy"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="151" y="955"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||
|
|
|
|||
Loading…
Reference in New Issue