Last active
February 3, 2017 05:04
-
-
Save SAllen0400/682e3e6cd316925ef8c20dfd1b071fac to your computer and use it in GitHub Desktop.
Example of Filtering Duplicates from Array Swift
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
// Swift 3 | |
func setupBeaconRegions() { | |
// Use the .filterDuplicates function on an array of beacons to create a new array of only unique UUID's | |
let beaconRegions: [iBeaconItem] = iBeacons.filterDuplicates { $0.uuid == $1.uuid && $0.uuid == $1.uuid } | |
// Iterate through new array that only contains unique UUIDs and start ranging those | |
for beacon in beaconRegions { | |
startRangingBeacon(beacon) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment