Skip to content

Latest commit

 

History

History
56 lines (41 loc) · 1.12 KB

README.md

File metadata and controls

56 lines (41 loc) · 1.12 KB

JavaScriptSwift

JavaScriptSwift library to run JavaScript in pure iOS Swift.

Example

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: "matvii@hodovani.uk"
        },
        {
            name: "Max",
            twitter: "@maxdesiatov",
            email: "max@desiatov.com"
        }
    ]
};
""")

Now you can access swiftLib fields. For example:

var conference = context.swiftLib.name
// conference will be "JavaScript.swift"

Requirements

  • Xcode 10.2
  • Swift 5.0
  • iOS 7.0+ / macOS 10.5+ / tvOS 9.0+

Author

Matvii Hodovaniuk

License

JavaScriptSwift is available under the Apache 2.0 license. See the LICENSE file for more info.