API Documentation

To use the iSwift API, all you have to do is Subscribe for an API key and then
use one of the following ways to access it and instantly convert your Objective-C sources to Swift.

Request

URL: https://iswift.org/api
POST Request:

  • source: Your source code
  • api: Your API key


Example - Using PHP


$source = "\
	#import <Cocoa/Cocoa.h>\
	\
	@implementation aClass\
	\
	- (void)main:(int)myVar {\
		NSString* a = @\"myString\";\
	\
	}\
	\
	@end";

$url = 'https://iswift.org/api';
$data = array('source' => $source, 'api' => '<YOUR_API_KEY>');

$options = array(
    'http' => array(
        'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
        'method'  => 'POST',
        'content' => http_build_query($data),
    ),
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);

$result = json_decode($result);


Response

Here is a sample response:


{
	"response": "import Cocoa\n\nclass aClass {\n\n\tfunc main(myVar: Int) {\n\t\tvar a: String = \"myString\"\n\n\t}\n\n}",
	"success": true
}
				
* If you have any problem whatsoever, just drop a message and you'll receive an answer ASAP.


}