As I’m sure everyone’s aware, Xcode 13 introduced a severe bug: outlets specified in scripts are not recognized in Interface Builder anymore. It’s still not fixed in Xcode 14.
I have my workaround but I wonder if there are smarter ways to deal with this bug.
Here’s what I’m doing:
Have the app delegate object instantiated in IB (it’s always instantiated in my apps anyway).
In the script, create a usual outlet property:
property appController : missing value
Then in the beginning of the script add the following:
set appController to current application‘s NSApp‘s delegate()
appController property can now be used as an outlet as usually.
If I need another outlet in the script, I first define it in the delegate header:
@property (nonatomic, retain) IBOutlet NSSomeClass *anotherOutlet;
Then call this property in the script:
set anotherOutlet to appController‘s anotherOutlet()
anotherOutlet can also be used as a regular outlet.
So this method works. But, once again, I wonder if there are better workarounds for this bug?