📜  ios 网络请求 - Swift 代码示例

📅  最后修改于: 2022-03-11 15:01:02.334000             🧑  作者: Mango

代码示例1
let url = URL(string: "http://www.stackoverflow.com")!

let task = URLSession.shared.dataTask(with: url) {(data, response, error) in
    guard let data = data else { return }
    print(String(data: data, encoding: .utf8)!)
}

task.resume()