iOS Plugin Loading #68
Replies: 1 comment
-
In the AppKit (macOS) version of STTextView, there are the following code for adding and setting-up plugins: STTextView/Sources/STTextViewAppKit/STTextView.swift Lines 1370 to 1402 in 8d5d376 After I added the same code of UIKit (iOS) source, it first didn't work. But, after I removed the The final added piece of code is: open func addPlugin(_ instance: any STPlugin) {
let plugin = Plugin(instance: instance)
plugins.append(plugin)
setupPlugins()
}
private func setupPlugins() {
for (offset, plugin) in plugins.enumerated() where plugin.events == nil {
// set events handler
var plugin = plugin
plugin.events = setUp(instance: plugin.instance)
plugins[offset] = plugin
}
}
@MainActor
private func setUp(instance: some STPlugin) -> STPluginEvents {
// unwrap any STPluginProtocol
let events = STPluginEvents()
instance.setUp(
context: STPluginContext(
coordinator: instance.makeCoordinator(context: .init(textView: self)),
textView: self,
events: events
)
)
return events
} However, it seems that |
Beta Was this translation helpful? Give feedback.
-
Following this, I am still trying to make the dummy plugin working on iOS so I can start to port other plugins, however I found out that the plugin adding/setup seems just missing from the STTextViewUIKit, it is not possible to do
addPlugin
while using Storyboard and the plugin aren't really loaded when using SwiftUI (asaddPlugin
are not called?). Did I miss something?Beta Was this translation helpful? Give feedback.
All reactions