Convert CURL commands to Swift code online

Curl command

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

CURL to Swift online

This tool helps you to generate Swift code based on CURL command. Copy and paste CURL command and generate Swift.

What can you do with CURL to Swift converter online?

  • CURL to Swift is very unique tool to convert CURL command to Swift request of Swift. The input provide by the user's CURL command to generate Swift code.
  • This tool saves your time and helps to generate Swift code with ease.
  • CURL to Swift works well on Windows, MAC, Linux, Chrome, Firefox, Edge and Safari.

what is CURL?

CURL is an open-source command line tool that downloads files from the web. It supports a variety of protocols, including Swift, SwiftS, FTP, SFTP, TFTP, Gopher and others.

How do convert CURL to Swift code? 

Step1: Paste and convert your CURL requests to Swift code

Step2: Copy Swift code

Convert CURL to Swift example

CURL
curl example.com
PHP Guzzle
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()