The codebase of Textual was modified significantly in version 6.0.0. Many classes are no longer public. Others are now immutable by default. Some methods and properties have been removed or renamed.
Because of this, to prevent crashes, Textual 6 will refuse to load any plugins that were built against Textual 5.
Not much is required for most plugins to support Textual 6. Ensuring code points to renamed methods and properties is usually all that is required. Some plugins, such as those requiring access to Webkit, will require more work.
Before a plugin can be loaded, it must first state that it's compatible with Textual 6.
This can be accomplished by adding the following entry to the plugin's Info.plist file:
Textual's codebase is now non-nil by default, unless stated otherwise by a declaration of nullable or _Nullable. Methods and properties that are non-nil now throw an exception if nil input is given.
TVCLogView exposes several
methods to make this as pain-free as possible.
The following methods can be used to evaluate a named function.
- (void)evaluateFunction:(NSString *)function; - (void)evaluateFunction:(NSString *)function withArguments:(nullable NSArray *)arguments; - (void)evaluateFunction:(NSString *)function withArguments:(nullable NSArray *)arguments completionHandler:(void (^ _Nullable)(id _Nullable result))completionHandler;
An argument can be NSArray, NSDictionary, NSNull, NSNumber, or NSString.
Arguments can be nested. For example, an NSDictionary can contain multiple NSArray objects.
An unknown argument type, such as a custom class, is treated as undefined.
The following Objective-C code:
TVCLogView *webView = mainWindow().selectedItem.viewController.backingView; NSString *remoteScriptURL = @"https://www.example.com/scripts/a.js"; [webView evaluateFunction:@"Textual.includeScriptResourceFile" withArguments:@[remoteScriptURL]];
plugin at any time using the function