• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[PSA] native AppleScripting support for Swift
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[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


_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden


  • Prev by Date: Re: AppleScriptObjC oddity
  • Next by Date: Parsing two dates in Apple Mail for Calendar
  • Previous by thread: Re: AppleScriptObjC oddity
  • Next by thread: Re: [PSA] native AppleScripting support for Swift
  • Index(es):
    • Date
    • Thread