Go to file
Maksym Grebenets a69009581c Bump to 1.0.0 2018-03-02 12:06:10 +11:00
Example Bump to 1.0.0 2018-03-02 12:06:10 +11:00
Pod Update for Xcode 9.2 and Swift 4 2018-03-02 12:03:02 +11:00
.gitignore Initial commit 2015-10-07 18:53:07 +11:00
.rubocop.yml Update for Xcode 9.2 and Swift 4 2018-03-02 12:03:02 +11:00
.rubocop_general.yml Update for Xcode 9.2 and Swift 4 2018-03-02 12:03:02 +11:00
.swift-version Update for Xcode 9.2 and Swift 4 2018-03-02 12:03:02 +11:00
.travis.yml Update for Xcode 9.2 and Swift 4 2018-03-02 12:03:02 +11:00
LICENSE Initial commit 2015-10-06 22:59:21 +11:00
README.md Add link to blog post 2015-10-10 18:07:19 +11:00
SwiftScriptRunner.podspec Bump to 1.0.0 2018-03-02 12:06:10 +11:00
_Pods.xcodeproj Initial commit 2015-10-06 22:59:21 +11:00

README.md

SwiftScriptRunner

CI Status Version License Platform

A simple utility for writing Swift scripts with async callbacks to 3rd party frameworks.

See this blog post for more details.

Requirements

  • Xcode 7.0.1
  • cocoapods gem version 0.38.2
  • cocoapods-rome gem version 0.2.0
  • carthage version 0.8.0

Installation

SwiftScriptRunner is available through CocoaPods Rome and Carthage.

CocoaPods Rome

Make sure you have cocoapods-rome Ruby gem installed.

Add the following line to your Podfile:

platform :osx, '10.10'
use_frameworks!
plugin 'cocoapods-rome'

pod "SwiftScriptRunner"

And run

pod install --no-integrate

Carthage

Add the following line to your Cartfile:

github "mgrebenets/SwiftScriptRunner"

And run

carthage update --platform mac

Usage

Example with Alamofire.

// alamofire.swift

import Alamofire
import SwiftScriptRunner

var runner = SwiftScriptRunner()
runner.lock() // Lock

Alamofire.request(.GET, "http://httpbin.org/get", parameters: ["foo": "bar"])
         .responseJSON { response in
             print(response.result)   // Result of response serialization
             runner.unlock() // Unlock
         }

runner.wait() // Wait

Now you can run it.

# When using CocoaPods
swift -F Rome alamofire.swift

# When using Carthage
swift -F Carthage/Build/Mac alamofire.swift

Author

Maksym Grebenets, mgrebenets@gmail.com, @mgrebenets

License

SwiftScriptRunner is available under the MIT license. See the LICENSE file for more info.