via Swift Scripting (Part 1) | Majesty Thoughtware.
When I first heard of the ability to invoke Swift scripts via the Unix hash-bang (
#!) convention, what first came to mind was using Swift for the sort of tasks that one might tackle with Bash or Python. It turns out that the language isn’t quite set-up for that pattern of usage, although some have taken steps to fill in the blanks (See SwiftShell.)
Later, I began to explore the use of Swift as a replacement for AppleScript. AppleScript is the user-facing component of the Open Scripting Architecture. It enables end users to orchestrate workflows of varying complexity by sending appropriate commands to one or more applications. I’ve dabbled in AppleScript since it’s debut in 1993, and I’ve often found the language to be a source of frustration. This is partly due to my strong bias towards “normal” programming languages.
Since JXA is so new, there obviously was not much information to go by. I’ve never gotten around to learning AppleScript, so articles based on the classic OS X automation language were not much help either, although I’m not sure how much they would apply anyway. The result was quite a few wasted hours trying to figure out some of the most basic parts of JXA, such as proper syntax of method calls, which method calls worked with which apps, and how to identify UI Elements in order to trigger them with UI automation. Eventually I was able to figure these things out, so now I’m back to share what I learned.
A small Apple Automator application which makes it possible to use the traditional Mac OS X system-font “Lucida Grande” on OS X 10.10 Yosemite. Full Read>>
Font awesome can be a useful part of any project. It comes with a set of common icons and image assets. Since you use text instead of images, you can customize the color and resize without pixellation.
Common use cases include social media icons, button icons, camera and play button overlays, etc.
Integrating font awesome is as simple as integrating any other font.
- Create a new project
- Download font awesome from http://fortawesome.github.io/Font-Awesome/
- Unzip the folder and drag fonts/fontawesome-webfont.ttf into your project
- Open Supporting Files/Info.plist
- Add a new key “Fonts provided by application”. This is of type Array.
- Expand the array, and for Item 0, set the string value to “fontawesome-webfont.ttf”
Now that you have integrated font awesome into your project, try to create an icon.
Xcode is the development environment that Apple supplies to the community for creating Mac and iOS apps. Those familiar with the tool will likely agree that working with previous versions have been nothing short of a love/hate relationship. After any update, Xcode’s quirks and crashes are never far behind, however it is one utility that Mac and iOS developers simply could not live without.
Xcode 6 brings exciting new features and enhancements including support for an entirely new programming language, improved view debugging, live view rendering, extensions, playgrounds, and more.