This week I am laying down the start of a new series of articles providing code snippets, hints, and other material which I hope will be a help to those getting started writing Swift 3, particularly for scripting purposes.
I have moaned repeatedly about the state of documentation of Swift 3 and its interfaces with macOS. Although I have written several articles here which consider coding matters, their code examples and information are scattered unsystematically across a growing number, and are not easy to access.
I am not quoting these code examples from books, other sites, or making them up out of my head: each is taken from an app which actually works. They are written for Xcode 8.2.1 (the current version) with its implementation of Swift 3.0.2, running on macOS Sierra 10.12.3.
As I write and post more Swift code here, I will update these articles, forking them as they grow. Articles currently available are:
1: strings, files, bundles (String, FileManager, Bundle)
2: processes, running commands, predicates, playgrounds (Process, NSAppleScript, NSPredicate, running Swift from the command line, Xcode Playgrounds)
3: UI, alerts, text boxes, radio buttons, popup menus, file save (NSAlert, NSAttributedString, NSSavePanel)
Swift Documentation Markup
Resources to help the non-novice learn and use Swift on macOS
Please correct and add to each using comments.
I hope that you find these useful.