As many of you know, I’ve been doing a lot of macOS and iOS declare work this year, answering as many questions as I possibly can. Since my time seems to be getting more and more limited, I’ve been sharing some of the scripts I use to make that process a little less painful.
Today I’m pleased to announce that the biggest workhorse in that suite of scripts is now available in my XojoCodeAssistants repository on Github which greatly reduces the amount of time needed to convert Apple’s Objective-C docs to Xojo Declares.
The newly added script called DeclareMaker allows you to convert declares almost as easily as Copy & Paste. Here’s a video showing how easy it is to create a declare that lets you an iOS button automatically change its caption whenever the button is disabled:
The script is included in my XojoCodeAssistants repo and is compatible with versions of Xojo going back to 2022r1.
Keep in mind that:
- It cannot possibly know all of the TypeDefs that Apple provides and will default to Ptr if it doesn’t know. You will need to look up a type and change it, especially for parameters that are enums or constants.
- There are some known issues with methods that take completion handlers. I haven’t had the time or the inclination to fix those. If you manage to without breaking the rest of the script, please fork the repo and make a pull request.