swiftUI-native floating widget?

Hi. Is there any way to have SwiftUI-native view via BTT Floating Menus feature?

yes, you can have native swift plugins that you can then use in floating menus (only on macOS though, not iOS)

Tks a lot for the resources, which seems promising. Do you have some example .bttpreset file for this use case? That’d be highly appreciated.

For instance, do you think it’s possible to show a swiftUI liquid-glass button showing current date?

Here is an example with an analog clock:

clock-swift-example.bttpreset (34.2 KB)

It might require to restart BTT after compiling & loading the plugin.

The plugin source & compiled version go into ~/Library/Application Support/BetterTouchTool/Plugins

1 Like

Ah and by the way, the "Ask AI" feature in BTT is pretty good at generating such native floating menu plugins for you.

Thanks. I’ll give it a try soon.

@Andreas_Hegenberg the widget didn’t seem to render glassEffect correctly in my test. Also, the option `Background > Liquid Glass` doesn’t look native to me. Below is an example of the desired look.

import SwiftUI

struct ContentView: View {
    var body: some View {
        Button {
            // Button action here
        } label: {
            VStack(spacing: 12) {
                Image(systemName: "globe")
                    .imageScale(.large)
                Text("Hello, world!")
                    .font(.headline)
            }
            .padding(40) // Give the glass some room to breathe
        }
        .glassEffect(
            .regular.interactive(),
            in: .rect(cornerRadius: 22)
        )
    }
}