Swift API for Ngrok Agent API.
Apple Platforms
- Xcode 16.0 or later
- Swift 6.0 or later
- iOS 17 / watchOS 10.0 / tvOS 17 / macOS 14 or later deployment targets
Linux
- Ubuntu 20.04 or later
- Swift 6.0 or later
To integrate Ngrokit into your app using SPM, specify it in your Package.swift file:
let package = Package(
...
dependencies: [
.package(url: "https://github.com/brightdigit/Ngrokit.git", from: "1.0.0")
],
targets: [
.target(
name: "YourServerApp",
dependencies: [
.product(name: "Ngrokit", package: "Ngrokit"), ...
]),
...
]
)
Ngrokit is an easy to use Swift library for call the local Ngrok API as well as running the ngrok
command.
Using the NgrokClient
to connect to your local development server:
let client = NgrokClient(transport: URLSession.shared)
For using different transports see the client list at the Swift OpenAPI Generator.
Start the CLI process by using NgrokProcessCLIAPI
:
let cliAPI = NgrokProcessCLIAPI(ngrokPath: "/usr/local/bin/ngrok")
let process = api.process(forHTTPPort: 100)
process.run { let error in
print(error)
}
To learn more, check out the full documentation.
This code is distributed under the MIT license. See the LICENSE file for more info.