Swift Script Source/Framework Import

So this idea is around the idea of Mac Administrators using Swift to provide dialog boxes, and access to native APIs that they currently are using PyObjC for.

The idea is to allow the ability for /usr/bin/swift to import frameworks and/or source files to be included during execution. This would empower someone to build a "Template" that can just be called upon by their script.
An example of this would be:

  • A framework is built for the company's dialog boxes to display information to the end user.
  • Admin creates a script which would prompt the user to enter some information
    • Admin is able to just call the framework to generate all of the stuff needed and display the dialog box in approved styling
  • User enters information in the dialog box
  • Admin then continues with the script to parse user information.

Without being able to import Frameworks or Source files, the actual script file can grow very quickly and could end up causing easy errors to be harder to catch.

Check out https://github.com/mxcl/swift-sh

1 Like

That would work for my local machine, but not really an option to brew install it on our whole fleet of 9,000 Macs.

Quite a resurrection, but I wonder if there are solutions for this now that are built into the swift CLI itself?

Would be great (especially for teaching Swift!) to be able to import 3rd party frameworks into a script with ease.

If I understand correctly, I believe @stevapple is working on this as part of a GSoC 2021 project:

1 Like

Ah, yep that's totally it. Can't wait for it