objc compatible with swift

This commit is contained in:
boedy 2019-05-09 15:32:48 +02:00
parent 3b868a78c3
commit 5d08202131

View File

@ -70,6 +70,7 @@
completionBlock(response!) completionBlock(response!)
} }
@objc(onRequest:)
func onRequest(_ command: CDVInvokedUrlCommand) { func onRequest(_ command: CDVInvokedUrlCommand) {
self.onRequestCommand = command self.onRequestCommand = command
let pluginResult = CDVPluginResult(status: CDVCommandStatus_NO_RESULT) let pluginResult = CDVPluginResult(status: CDVCommandStatus_NO_RESULT)
@ -90,10 +91,12 @@
) )
} }
@objc(sendResponse:)
func sendResponse(_ command: CDVInvokedUrlCommand) { func sendResponse(_ command: CDVInvokedUrlCommand) {
self.responses[command.argument(at: 0) as! String] = command.argument(at: 1) self.responses[command.argument(at: 0) as! String] = command.argument(at: 1)
} }
@objc(start:)
func start(_ command: CDVInvokedUrlCommand) { func start(_ command: CDVInvokedUrlCommand) {
var port = 8080 var port = 8080
let portArgument = command.argument(at: 0) let portArgument = command.argument(at: 0)
@ -110,6 +113,8 @@
self.commandDelegate!.send(pluginResult, callbackId: command.callbackId) self.commandDelegate!.send(pluginResult, callbackId: command.callbackId)
} }
@objc(stop:)
func stop(_ command: CDVInvokedUrlCommand) { func stop(_ command: CDVInvokedUrlCommand) {
if self.webServer.isRunning { if self.webServer.isRunning {
self.webServer.stop() self.webServer.stop()