Wrong documentation for using capacitor plugin in ios
lclrobert2020 opened this issue · 1 comments
lclrobert2020 commented
From this website
After adding a capacitor dependency in your Podfile,
the instruction says the plugin should be registered in viewDidload()
override func viewDidLoad() {
// Inject the plugin into the native bridge
apiPlugin = bridge?.plugin(withName: "MyPlugin") as? MyPlugin
// now call super which will start the initial load
super.viewDidLoad()
}
But in the example e-com app link here
The project use "CapacitorCamera"
but it wasn't registered any where in all of the view model files
the only plugin registered is a local plugin
func handle(bridge: CAPBridgeProtocol?) {
subRef = PortalsPlugin.subscribe("dismiss") { [weak self] result in
if result.data as! String == "cancel" || result.data as! String == "success" {
DispatchQueue.main.async {
self?.shouldDisplayCheckout = false
}
}
}
apiPlugin = bridge?.plugin(withName: "ShopAPI") as? ShopAPIPlugin
apiPlugin?.dataProvider = coordinator.dataStore
apiPlugin?.actionDelegate = self
}
I think the plugins are auto registered like the one from the community plugins,
the website also stated this for the community plugins
Plugins are automatically registered on iOS.
So i guess the plugins are auto registered if they are installed by pod ?
Steven0351 commented
You are correct, and the documentation updates in #145 addresses this