Re: Calling out to Swift from AppleScript
Re: Calling out to Swift from AppleScript
- Subject: Re: Calling out to Swift from AppleScript
- From: Shane Stanley <email@hidden>
- Date: Tue, 14 Mar 2017 23:46:13 +1100
On 14 Mar 2017, at 11:31 pm, Neil Faiman <email@hidden> wrote:
>
> Is it possible to write a framework (preferably in Swift) which can then be included, or used, into an AppleScript script?
I suspect you'll need an Objective-C interface -- there's no way to call Swift directly.
> If so, can someone provide a pointer a a guide on the tricks and techniques?
For Objective-C there's nothing much too it. Write your framework, then load it using a "load framework" statement.
The only potential gotcha is that you need to be careful with enums and constants. Best to add a Run Script build phase to add a suitable .bridgesupport file, like this:
mkdir -p $TARGET_BUILD_DIR/$PRODUCT_NAME.framework/Resources/BridgeSupport/
cd $TARGET_BUILD_DIR
gen_bridge_metadata --64-bit -f $TARGET_BUILD_DIR/$PRODUCT_NAME.framework/ -o $TARGET_BUILD_DIR/$PROJECT_NAME.framework/Resources/BridgeSupport/$PRODUCT_NAME.bridgesupport
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>
_______________________________________________
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