Flick control
Mount the slide menu, select its context, and add your app’s menu items.
The Flick control’s slide menu is a 21st-century paperclip: an assistant inside your app, connected to the context and operations you expose.
Mount the control
Start with the MyApp declaration and SDK root from Quick start.
These examples place .flickable inside ContentView. Remove the modifier from MyAppApp if you added it in Quick start:
import FlickSDK
import SwiftUI
// Scene root: FlickSDK { ContentView() }
struct ContentView: View {
var body: some View {
Text("My app")
// .myApp is generated from @FlickScope enum MyApp
.flickable(in: .from(.myApp)) // Select MyApp's registered actions and state
}
}The control appears while the screen is mounted. Each scene shares one control, which stays available while any .flickable surface is mounted.
When the control is idle:
| Interaction | Default behavior |
|---|---|
| Tap | Open the prompt tray to create a Flick |
| Drag down | Open a menu of recent Flicks and the account connection item |
| Swipe up | Browse recent Flicks in the stack, when available |
Add menu items
Replace ContentView above with this version to add Settings to the slide menu:
import FlickSDK
import Joy // Slide menu actions
import SwiftUI
struct ContentView: View {
@State var showsSettings = false
var body: some View {
Text("My app")
// This builder replaces default entries; list them in display order
.flickable(in: .from(.myApp)) { items in
items.RecentFlickItems // Keep recent Flicks compatible with this context
Drag(
.down, "Settings", // Add Settings to the downward menu
presentAs: .menu, // Show a menu even when this is its only item
systemImage: "gearshape"
) {
showsSettings = true // Opens this view's SwiftUI sheet
}
// Keep Connect Flick / Disconnect Flick when available
items.AuthenticationItem
}
.sheet(isPresented: $showsSettings) {
Text("Settings")
}
}
}The SDK’s tap-to-prompt and dismissal gestures remain available alongside your menu.
Keep gestures on the underlying screen
Add .trayOnly as the first argument of your existing .flickable call, keeping any menu builder:
// Limit drag-to-dismiss to the running Flick's tray
.flickable(.trayOnly, in: .from(.myApp))Gestures outside the running Flick’s tray stay on your screen. The prompt tray keeps its default interaction.