capacitor-promocode/ios/Sources/PromoCodePlugin/PromoCodePlugin.swift
2025-04-13 17:56:38 -04:00

24 lines
680 B
Swift

import Foundation
import Capacitor
/**
* Please read the Capacitor iOS Plugin Development Guide
* here: https://capacitorjs.com/docs/plugins/ios
*/
@objc(PromoCodePlugin)
public class PromoCodePlugin: CAPPlugin, CAPBridgedPlugin {
public let identifier = "PromoCodePlugin"
public let jsName = "PromoCode"
public let pluginMethods: [CAPPluginMethod] = [
CAPPluginMethod(name: "echo", returnType: CAPPluginReturnPromise)
]
private let implementation = PromoCode()
@objc func echo(_ call: CAPPluginCall) {
let value = call.getString("value") ?? ""
call.resolve([
"value": implementation.echo(value)
])
}
}