Skip to content

Instantly share code, notes, and snippets.

@mikebuss
Created January 28, 2020 00:02
Show Gist options
  • Save mikebuss/eccf31d0a45f7564b788d62cd6f8a8d6 to your computer and use it in GitHub Desktop.
Save mikebuss/eccf31d0a45f7564b788d62cd6f8a8d6 to your computer and use it in GitHub Desktop.
Query Devices in Swift
func queryForDevices() {
let rPi = URL(string: "http://10.3.141.1:8080/devices")!
let task = URLSession.shared.dataTask(with: rPi) {(data, response, error) in
guard let data = data else { return }
print(String(data: data, encoding: .utf8)!)
}
task.resume()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment