Files
archived-plugins-workspace/shared/template/ios/Sources/ExamplePlugin.swift
Lucas Fernandes Nogueira a34fade500 chore(ios): consolidate optional argument standard (#1738)
* chore(ios): consolidate optional argument standard

mark all optional iOS arguments as `var <name>: Type?`, following the pattern described in the documentation: https://v2.tauri.app/develop/plugins/develop-mobile/#ios

* chore: add missing Info.plist to example
2024-09-10 08:31:39 -03:00

25 lines
547 B
Swift

// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
import SwiftRs
import Tauri
import UIKit
import WebKit
class PingArgs: Decodable {
var value: String?
}
class ExamplePlugin: Plugin {
@objc public func ping(_ invoke: Invoke) throws {
let args = try invoke.parseArgs(PingArgs.self)
invoke.resolve(["value": args.value ?? ""])
}
}
@_cdecl("init_plugin_{{ plugin_name_snake_case }}")
func initPlugin() -> Plugin {
return ExamplePlugin()
}