Created
September 15, 2015 11:06
-
-
Save mane87/8068ccfcfa2dd91f02bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewDidLoad() { | |
super.viewDidLoad() | |
self.setUpLocationmanager() | |
let beaconSequence = locationManager.rx_didRangeBeaconsInRegion.map{$0.beacons} | |
let sortedBeaconSequence = beaconSequence.map{beacons in self.sortBeaconsByRSSI(beacons)} | |
let nearestBeaconSequence = sortedBeaconSequence.map({$0[0]}) | |
.filter{$0.proximity == CLProximity.Immediate} | |
.distinctUntilChanged{$0.minor == $1.minor} | |
nearestBeaconSequence.subscribeNext{beacon in | |
print("\(beacon)") | |
self.configureView(beacon.minor.intValue) | |
} | |
.addDisposableTo(disposeBag) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment