2023-02-15 17:42:47 +03:00
|
|
|
import UIKit
|
2023-02-11 16:30:44 +03:00
|
|
|
import WebKit
|
|
|
|
import Tauri
|
2023-03-18 16:57:05 +03:00
|
|
|
import SwiftRs
|
2023-02-11 16:30:44 +03:00
|
|
|
|
2023-02-15 03:36:44 +03:00
|
|
|
class ExamplePlugin: Plugin {
|
2023-02-11 16:30:44 +03:00
|
|
|
@objc public func ping(_ invoke: Invoke) throws {
|
|
|
|
let value = invoke.getString("value")
|
2023-02-15 17:42:47 +03:00
|
|
|
invoke.resolve(["value": value as Any])
|
2023-02-11 16:30:44 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@_cdecl("init_plugin_{{ plugin_name_snake_case }}")
|
2023-03-18 16:57:05 +03:00
|
|
|
func initPlugin(name: SRString, webview: WKWebView?) {
|
|
|
|
Tauri.registerPlugin(webview: webview, name: name.toString(), plugin: ExamplePlugin())
|
2023-02-11 16:30:44 +03:00
|
|
|
}
|