[PSA] native AppleScripting support for Swift
[PSA] native AppleScripting support for Swift
- Subject: [PSA] native AppleScripting support for Swift
- From: has <email@hidden>
- Date: Mon, 13 Jul 2015 15:25:17 +0100
Hi all,
In light of OS X 10.11 addressing some longstanding deficiencies in
NSAppleEventDescriptor, I've been dusting off a fork of my old
objc-appscript project, now renamed AppleEventBridge, modernizing and
extending it both to take advantage of improvements to ObjC in the last
few years and to add native support for Apple's new Swift language:
https://bitbucket.org/hhas/appleeventbridge/
Unlike Apple's flawed Scripting Bridge and JavaScript for Automation,
AEB aims to provide application scripting capabilities and compatibility
that equal (if not better) AppleScript's own, along with superior
documentation and developer tool support.
Here's a simple example, comparing AEB's new Swift and ObjC bindings
against de facto standard AppleScript:
tell application "TextEdit" to get text of document 1
let result = try TextEdit().documents[1].text.get() as! String
id result = [[TEDApplication application].documents[1].text getItem];
A simple Apple event translation tool, SwiftAETranslate, is included in
the project, making it easy to convert AppleScript commands to their
Swift equivalents. It's a great learning tool if you've always found
AppleScript code perplexing, and well worth pulling the project just to
try it out yourself:
git clone https://bitbucket.org/hhas/appleeventbridge.git
Swift support requires Swift 2.0 and Xcode 7 beta 3 or later, and works
on 10.10+.
While this release is not intended for production use (builds are rather
messy and there's still rough edges and bugs), it is sufficiently mature
to allow interested Swift and ObjC users to explore and experiment with
it, and to offer advice, suggestions, and other feedback with a view to
getting the whole thing to a production-quality 1.0 release before the
end of the year.
Enjoy, and I look forward to hearing what you think.
has
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden