-
Notifications
You must be signed in to change notification settings - Fork 977
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ios): Plugin Registration and Plugin Instance Support (#6072)
* feat(ios): Adds support for manual registration for plugins and the ability to register instances of plugins so that plugins can be instantiated by the user instead of relying on the bridge.
- Loading branch information
1 parent
3d5b7c2
commit 9f1d863
Showing
6 changed files
with
111 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// | ||
// CAPInstancePlugin.swift | ||
// Capacitor | ||
// | ||
// Created by Steven Sherry on 11/21/22. | ||
// Copyright © 2022 Drifty Co. All rights reserved. | ||
// | ||
|
||
/// A CAPPlugin subclass meant to be explicitly initialized by the caller and not the bridge. | ||
@objc open class CAPInstancePlugin: CAPPlugin {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// CAPPlugin+LoadInstance.swift | ||
// Capacitor | ||
// | ||
// Created by Steven Sherry on 11/9/22. | ||
// Copyright © 2022 Drifty Co. All rights reserved. | ||
// | ||
|
||
extension CAPPlugin { | ||
func load(as bridgedType: CAPBridgedPlugin.Type, on bridge: CAPBridgeProtocol) { | ||
self.bridge = bridge | ||
webView = bridge.webView | ||
pluginId = bridgedType.pluginId() | ||
pluginName = bridgedType.jsName() | ||
shouldStringifyDatesInCalls = true | ||
retainedEventArguments = [:] | ||
load() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters