JavaScriptSwift library to run JavaScript in pure iOS Swift.
Use JavaScriptSwift.import
to import JavaScript context to your project. For example:
import JavaScriptSwift
let context = JavaScriptSwift()
try context.importSafe("""
var swiftLib = {
name: "JavaScript.swift",
organizers: [
{
name: "Matvii",
twitter: "@hodovani",
email: "[email protected]"
},
{
name: "Max",
twitter: "@maxdesiatov",
email: "[email protected]"
}
]
};
""")
Now you can access swiftLib
fields. For example:
var conference = context.swiftLib.name
// conference will be "JavaScript.swift"
- Xcode 10.2
- Swift 5.0
- iOS 7.0+ / macOS 10.5+ / tvOS 9.0+
JavaScriptSwift is available under the Apache 2.0 license. See the LICENSE file for more info.