Writing persistent include scripts in Swift

12 views
Skip to first unread message

Neil Faiman

unread,
Feb 15, 2021, 9:40:23 PM2/15/21
to BBEdit Talk Mailing List
I maintain a web site whose content management is largely accomplished with BBEdit persistent includes. When I started working with persistent includes some 20 years ago, I tended generally used AppleScript, which was cool, but it was .... AppleScript. Later, I switched over to Perl. Perl is powerful, but I can no longer even read some of those scripts, much less maintain them.

Swift promises to be, among other things, a scripting language, so more recently, I've been experimenting with writing persistent include scripts in Swift. This is generally a pleasant experience, but some things require some additional thought. In particular, after finding myself cutting and pasting the code for retrieving persistent include parameters from one script to another, I decided to encapsulate the parameter logic in a simple Swift module that I can include in all my scripts.

I've published the Xcode project for the module, called PersistentIncludeParameters, on GitHub. If there is anyone else in the world who is interested in writing include scripts in Swift, you are invited to try out it out. It's at https://github.com/NeilFaiman/PersistentIncludeParameters.

Even if you aren't interested in the module itself, the README for the repository includes everything I've learned about the process and pitfalls of using Swift scripts with BBEdit.

Enjoy,

Neil Faiman
Reply all
Reply to author
Forward
0 new messages