tauri/tooling/cli/templates/plugin/ios/Sources/ExamplePlugin.swift

17 lines
422 B
Swift
Raw Normal View History

import UIKit
import WebKit
import Tauri
import SwiftRs
class ExamplePlugin: Plugin {
@objc public func ping(_ invoke: Invoke) throws {
let value = invoke.getString("value")
invoke.resolve(["value": value as Any])
}
}
@_cdecl("init_plugin_{{ plugin_name_snake_case }}")
func initPlugin(name: SRString, webview: WKWebView?) {
Tauri.registerPlugin(webview: webview, name: name.toString(), plugin: ExamplePlugin())
}