SwiftRunner can execute the string written in Swift on runtime.
How to use
Execute string as Swift
import SwiftRunner
let text = "print(\"hello!\")"
let result = SwiftRunner.shared.run(string: text) // => hello!
switch result {
case .success(let stream):
stream.output // => "hello!\n"
case .failure(let error): break
}
Features
Evaluate text written in Swift on runtime
Work on MacOS & Linux
Security measures
Waiting for your great pull requests :D
Try in Playground
This project contains a playground file. So you can try the features.
To try immediately, you can run the following:
$ cd <your working directory>
$ curl -sf https://raw.githubusercontent.com/tattn/SwiftRunner/master/scripts/try-playground.sh | sh -s
SwiftRunner
SwiftRunner can execute the string written in Swift on runtime.
How to use
Execute string as Swift
Features
Waiting for your great pull requests :D
Try in Playground
This project contains a playground file. So you can try the features.
To try immediately, you can run the following:
After building (⌘+B), you can try it :)
Requirements
Installation
Swift Package Manager
Contributing
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
License
SwiftRunner is released under the MIT license. See LICENSE for details.