Hi,
you should try this
[https://github.com/swisspol/GCDWebServer)
when you run GCDWebServer on your MacBook , you can access web page from your phone app ,
i'v just tested using swift ( URLRequest + URLSession )
var req = URLRequest(url: URL(string: "http://your_macos_ip_address:8080/")!)
if let error = error {
print("Failed: \(error)")
return
}
guard let data = data else {
print("data is nil")
return
}
print(" \(data.count) bytes and is: \n")
let responseText = String(data: data, encoding: .utf8) ?? "*unknow encoding*"
print("The response is: \(responseText)")
}
task.resume()
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: