twostraws / Brisk

A proof of concept scripting library for Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SwiftUI Support

cfwdman opened this issue · comments

In search for a small app to see countdowns in the macOS X menubar I stumbled across BitBar which launches scripts (with parameters) from a plugin folder and takes their output for display of a menu and submenues.

BitBar supports many languages including interpreted and compiled Swift.

Bitbar itself only displays menu structures and does not allow for input/configuration.
Hence configuration of the plugins is done by an UI which the script shows itself.
Python scripts e.g. make use of MacOS subprocess calls to osascript to diplay a simple dialog.

I'd love to use Swift scripts with SwiftUI for these dialogs.
What woud be the best way to include a swift UI which pops up only if configuration is required
(indicated by a command line switch)?

The Interface shall be simple and allow to add multiple timers in sequence (e.g. for an agenda within an presentation) which when started shall indicate the remaining time of each section and the finishing time to hit.
When all timers are added and user hit's "go" the UI shall be closed, values saved to a temp file and the script stopped.

I found two alternatives to add SwiftUI to Swift Scripts but this seems to be quite heavy (and rely on XCode 12...)

  1. Write SwiftUI command line scripts! - Using Swift - Swift Forums
  2. SwiftUI: Running a Mac App Without an Xcode Project · objc.io

I wish there was a more lightweight way with brisk... Is there an easy way one/you could extend brisk?