Ngonversi perintah CURL dadi kode Swift online

Curl command

Examples: GET - POST - JSON - Basic Auth - Files - Form

CURL menyang Swift online

Alat iki mbantu sampeyan ngasilake kode Swift adhedhasar printah CURL. Salin lan tempel printah CURL lan generate Swift.

Apa sampeyan bisa nindakake karo konverter CURL menyang Swift online?

  • CURL menyang Swift minangka alat sing unik banget kanggo ngowahi perintah CURL dadi panjaluk Swift saka Swift. Input diwenehake dening printah CURL pangguna kanggo ngasilake kode Swift.
  • Alat iki ngirit wektu lan mbantu nggawe kode Swift kanthi gampang.
  • CURL to Swift bisa digunakake kanthi apik ing Windows, MAC, Linux, Chrome, Firefox, Edge lan Safari.

apa iku CURL?

CURL minangka alat baris perintah open-source sing ndownload file saka web. Ndhukung macem-macem protokol, kalebu Swift, SwiftS, FTP, SFTP, TFTP, Gopher lan liya-liyane.

Kepiye carane ngowahi CURL dadi kode Swift? 

Langkah 1: Tempel lan ngowahi panjalukan CURL menyang kode Swift

Langkah 2: Nyalin kode Swift

Convert CURL kanggo conto Swift

KULIT
curl example.com
PHP Ngakak
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "http://example.com/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()