Run Swift

// Set the URL where we're making the request let request = NSURLRequest(URL: NSURL(string: "https://iswift.org")!) do { // Perform the request var response : AutoreleasingUnsafeMutablePointer<NSURLResponse?> = nil let data = try NSURLConnection.sendSynchronousRequest(request, returningResponse: response) // Get data as string let str = NSString(data: data, encoding: NSUTF8StringEncoding) print(str) } catch let error as NSError { print("Ooops! Something went wrong: \(error)") }

  

Check Out Our New iSwift Lead Generation Software Bundle

Start your free demo


Foundation framework not available
Swift version 4.0.3
@ Ubuntu 16.04
 

Run Swift is a web tool where you can easily try Apple's Swift language online. Just paste any snippet and click    Run . You may also    Save  your scripts and/or share with the world. If what you're looking for is an easy-to-use tool for your Mac, to quickly test and run Swift code, then you may want to have a look at our Run Swift app for MacOS.