Skip to content

Instantly share code, notes, and snippets.

@ericdke
Created January 9, 2016 22:00
Show Gist options
  • Select an option

  • Save ericdke/29f94d9235d2e3514ae2 to your computer and use it in GitHub Desktop.

Select an option

Save ericdke/29f94d9235d2e3514ae2 to your computer and use it in GitHub Desktop.
func getHostName(completion:(name:String)->()) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
if let name = NSHost.currentHost().localizedName {
completion(name: name)
}
}
}
getHostName { name in
print(name)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment