Skip to content

Instantly share code, notes, and snippets.

@SAllen0400
Last active February 3, 2017 05:04
Show Gist options
  • Save SAllen0400/682e3e6cd316925ef8c20dfd1b071fac to your computer and use it in GitHub Desktop.
Save SAllen0400/682e3e6cd316925ef8c20dfd1b071fac to your computer and use it in GitHub Desktop.
Example of Filtering Duplicates from Array Swift
// 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