Created
May 11, 2017 13:38
-
-
Save hsleedevelop/26f51a0308d52fe60579ff0de5f13b37 to your computer and use it in GitHub Desktop.
flatmap usage
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
let sdevices = devices.flatMap({ (device: Device) -> String in | |
return "\(device.brand)-\(device.hostname)-\(device.ipAddress)-\(device.macAddress)\n" | |
}).flatMap({$0}).joined() | |
DispatchQueue.main.async { | |
JDAlert(title: "Found \(devices.count) Device(s).", message: sdevices, preferredStyle: .alert) | |
.addAction(title: "OK", style: .default) { _ in } | |
.show() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment