Hi everyone.
I'm trying to use the new ControlWidget API introduced on iOS 18 to open a sheet that contains a form when the user taps on the button on the control center.
This is my current code. It opens the app, but I haven't found how to do an action inside the app when the app is opened.
@available(iOS 18, *)
struct AddButtonWidgetControl: ControlWidget {
var body: some ControlWidgetConfiguration {
StaticControlConfiguration(kind: "com.example.myapp.ButtonWidget") {
ControlWidgetButton(action: LaunchAppIntent()) {
Label("Add a link", systemImage: "plus")
}
}
.displayName("Add a link")
.description("Creates a link.")
}
}
@available(iOS 18, *)
struct LaunchAppIntent: AppIntent {
static var title: LocalizedStringResource { "Launch app" }
static var openAppWhenRun: Bool = true
func perform() async throws -> some IntentResult {
return .result()
}
}
Post
Replies
Boosts
Views
Activity
Hello everyone. I'm using a NavigationView inside a sheet to be able to add a navigation title.
NavigationView {
List {
...
}
.navigationTitle("Title")
}
And this is how it looks
The issue is that NavigationView is deprecated, and Xcode recommends replacing it with NavigationStack
NavigationStack {
List {
...
}
.navigationTitle("Title")
}
But now the title (by default, just when you open the sheet) looks different, it's like a bit scrolled.
Does someone know a solution for this?