The problem
Since iOS 18, third-party apps can put their own controls in Control Center, swap them for the flashlight and camera buttons on the Lock Screen, and assign them to the Action button. A control is one symbol, a title and an optional value, so the code is short. The hard parts are state and context. A toggle that shows “On” while your app is off destroys trust, a door unlock that runs from a locked phone is a security hole, and a title that reads well in Control Center can make no sense as Action button hint text. This guide covers each piece in the order you will hit it.
What a control is
Apple’s Creating controls to perform actions across the system defines the model. A control is either a button that performs an action, or a toggle that performs an action and switches between two states. It can also open your app to a specific screen or launch a locked camera capture extension. It lives in a widget extension, conforms to ControlWidget, and draws from a template: ControlWidgetButton or ControlWidgetToggle.
The system loads a control when someone adds it from the controls gallery. It reloads it when someone interacts with it, when your app asks through ControlCenter, or when it receives a push from APNs. Each load runs the control’s body and asks a value provider for the current state.
Federico Viticci summed up the result in his iOS 18 review: third-party controls show a symbol, a title and, at larger sizes, one more line of text, and they can be resized like widgets. He also noted that Apple mostly reused existing technology for this, which is good news for you: if your app already has App Intents, a control is mostly configuration.
Add the extension
In Xcode choose File > New > Target > Widget Extension and tick Include Control. If you already have a widget extension, add the control type to your existing WidgetBundle. The order inside the bundle is the order in the controls gallery.
import SwiftUI
import WidgetKit
@main
struct FocusWidgets: WidgetBundle {
var body: some Widget {
FocusTimerToggle()
NewNoteButton()
FocusStatsWidget()
}
}
Controls, widgets and Live Activities share the extension, so state they all read should live in an App Group.
A button that runs an action
A button takes any AppIntent. The intent’s perform() is the action; when it returns, the system queries the control again, so finish your work before returning.
import AppIntents
import SwiftUI
import WidgetKit
struct LogWaterIntent: AppIntent {
static let title: LocalizedStringResource = "Log a glass of water"
func perform() async throws -> some IntentResult {
try await HydrationStore.shared.logGlass()
return .result()
}
}
struct LogWaterButton: ControlWidget {
var body: some ControlWidgetConfiguration {
StaticControlConfiguration(kind: "com.example.health.logWater") {
ControlWidgetButton(action: LogWaterIntent()) {
Label("Log water", systemImage: "drop.fill")
}
}
.displayName("Log water")
.description("Adds one glass to today's total.")
}
}
HydrationStore is your shared persistence. Use an SF Symbol for the icon; Apple’s guide explains that the system applies tint, weight and scale to symbols, and custom symbols work too.
A button that opens the app
To jump into a screen, conform the intent to OpenIntent. Apple requires this intent to be a member of both the app target and the widget extension, or the app will not open. The target parameter tells the app where to go.
import AppIntents
enum AppScreen: String, AppEnum {
case newNote, search
static let typeDisplayRepresentation: TypeDisplayRepresentation = "Screen"
static let caseDisplayRepresentations: [AppScreen: DisplayRepresentation] = [
.newNote: "New note",
.search: "Search"
]
}
struct OpenScreenIntent: OpenIntent {
static let title: LocalizedStringResource = "Open screen"
@Parameter(title: "Screen")
var target: AppScreen
init() {}
init(target: AppScreen) {
self.target = target
}
@MainActor
func perform() async throws -> some IntentResult {
AppRouter.shared.show(target)
return .result()
}
}
AppRouter is a @MainActor @Observable singleton that your root view observes. Antonella Giugliano’s Create with Swift tutorial builds the same flow for a book app, with a navigation manager the intent reaches through @Dependency and openAppWhenRun. Both work. This article prefers OpenIntent because Apple’s docs use it for controls, it changes the Action button hint to “Hold to Open” automatically, and the same intent can open entities from Spotlight. Antoine van der Lee’s App Intent driven development makes the broader argument: one intent per action, reused by buttons in your app, controls and Shortcuts.
A toggle with real state
A toggle needs two things a button does not: a value provider that reports the current state, and a SetValueIntent that receives the new state.
import AppIntents
import SwiftUI
import WidgetKit
struct FocusTimerToggle: ControlWidget {
static let kind = "com.example.focus.timer"
var body: some ControlWidgetConfiguration {
StaticControlConfiguration(kind: Self.kind, provider: Provider()) { isRunning in
ControlWidgetToggle(
"Focus timer",
isOn: isRunning,
action: SetFocusTimerIntent()
) { isOn in
Label(isOn ? "Running" : "Stopped", systemImage: isOn ? "timer" : "timer.circle")
}
.tint(.indigo)
}
.displayName("Focus timer")
.description("Start or stop a 25-minute focus session.")
}
struct Provider: ControlValueProvider {
var previewValue: Bool { false }
func currentValue() async throws -> Bool {
await FocusTimer.shared.isRunning
}
}
}
struct SetFocusTimerIntent: SetValueIntent {
static let title: LocalizedStringResource = "Set focus timer"
@Parameter(title: "Running")
var value: Bool
func perform() async throws -> some IntentResult {
if value {
try await FocusTimer.shared.start()
} else {
try await FocusTimer.shared.stop()
}
return .result()
}
}
FocusTimer is an actor backed by App Group storage. Apple’s rules for the provider: previewValue is a synchronous canned value for the gallery, and currentValue() is fetched asynchronously whenever the control renders, so it can read a shared database or even a server. For the intent: the system fills value with the new state. Do not set it yourself; update your model to match.
Keep the control in sync
When the state changes outside the control, for example the timer ends or the person stops it in the app, tell the system:
import WidgetKit
enum ControlRefresher {
static func focusTimerChanged() {
ControlCenter.shared.reloadControls(ofKind: FocusTimerToggle.kind)
}
}
ControlCenter (iOS 18) also offers reloadAllControls() and currentControls(), which tells you which controls the person has added. For state that changes on a server, WidgetKit’s ControlPushHandler (iOS 18) lets your server trigger a reload over APNs, the push path Apple’s guide mentions in the control lifecycle.
Make it configurable
A light switch control is only useful if the person can pick the light. Use AppIntentControlConfiguration with an AppIntentControlValueProvider, and a configuration intent with the parameter. Apple’s refinements guide shows the full pattern; here is the shape for a timer with presets.
import AppIntents
import SwiftUI
import WidgetKit
struct TimerPreset: AppEntity {
static let typeDisplayRepresentation: TypeDisplayRepresentation = "Timer"
static let defaultQuery = TimerPresetQuery()
let id: String
let name: String
var displayRepresentation: DisplayRepresentation { "\(name)" }
}
struct TimerPresetQuery: EntityQuery {
func entities(for identifiers: [String]) async throws -> [TimerPreset] {
try await suggestedEntities().filter { identifiers.contains($0.id) }
}
func suggestedEntities() async throws -> [TimerPreset] {
[TimerPreset(id: "focus", name: "Focus"), TimerPreset(id: "break", name: "Break")]
}
}
struct SelectPresetIntent: ControlConfigurationIntent {
static let title: LocalizedStringResource = "Select timer"
@Parameter(title: "Timer")
var preset: TimerPreset?
}
struct PresetTimerToggle: ControlWidget {
struct TimerState {
let preset: TimerPreset
let isRunning: Bool
}
var body: some ControlWidgetConfiguration {
AppIntentControlConfiguration(
kind: "com.example.focus.preset",
provider: Provider()
) { state in
ControlWidgetToggle(
state.preset.name,
isOn: state.isRunning,
action: SetPresetTimerIntent(presetID: state.preset.id)
) { isOn in
Label(isOn ? "Running" : "Stopped", systemImage: "timer")
}
}
.displayName("Timer")
.promptsForUserConfiguration()
}
struct Provider: AppIntentControlValueProvider {
func previewValue(configuration: SelectPresetIntent) -> TimerState {
TimerState(preset: configuration.preset ?? TimerPreset(id: "focus", name: "Focus"), isRunning: false)
}
func currentValue(configuration: SelectPresetIntent) async throws -> TimerState {
let preset = configuration.preset ?? TimerPreset(id: "focus", name: "Focus")
return TimerState(preset: preset, isRunning: await FocusTimer.shared.isRunning(presetID: preset.id))
}
}
}
SetPresetTimerIntent follows the SetValueIntent pattern from the previous section with an extra presetID parameter and an initializer that sets it. promptsForUserConfiguration() makes the system ask for a choice as soon as someone adds the control to Control Center or the Lock Screen, or assigns it to the Action button, which is right for any control that does nothing until configured.
Secure what should not run locked
Controls are reachable from the Lock Screen without unlocking. Apple’s refinements guide gives two tools:
- Set
static let authenticationPolicy: IntentAuthenticationPolicy = .requiresAuthenticationon the intent to require Face ID, Touch ID or the passcode beforeperform()runs. Use it for anything harmful if triggered by accident or by someone else: unlocking a door, sending money, deleting data. - Apply
.privacySensitive()to the control template to redact its state while the device is locked. Apply it to just the value or label to hide that text while keeping the on/off state visible.
import AppIntents
struct UnlockGarageIntent: AppIntent {
static let title: LocalizedStringResource = "Open garage"
static let authenticationPolicy: IntentAuthenticationPolicy = .requiresAuthentication
func perform() async throws -> some IntentResult {
try await GarageClient.shared.open()
return .result()
}
}
Get the text right for each place
The same control shows different text in different places, and Apple’s guide spells out how.
- Control Center shows the title and value at larger sizes, and hides them at the smallest. The symbol has to carry the meaning alone.
- The Action button shows hint text built from
displayName(_:): “Hold for ‘Log water’” for a button, “Hold to Open MyApp” for anOpenIntent, and “Hold to Turn On …” or “Hold to Turn Off …” for toggles. Use.controlWidgetActionHint(_:)on the label for custom wording, and start it with a verb. - Momentary status.
.controlWidgetStatus(_:)shows a short message in Control Center after the action runs, such as how long a remotely started car will idle. Apple asks you to use it sparingly. - Tint.
.tint(_:)on the template sets the active color. Without it, the control uses the widget extension’s Global Accent Color, then the app’s, then the system default.
Keep displayName short and specific, and localize it. It is the name people see in the gallery and hear in hints.
Start a Live Activity from a control
A control button can start a Live Activity while your app stays in the background, which normally is not allowed. Apple’s Live Activities guide gives this exact case: make the button’s intent a LiveActivityIntent and call Activity.request in perform(). Viticci called out the same behavior in his review as one of the more useful tricks controls enable.
Beyond iPhone and iPad
Per the WWDC25 session What’s new in widgets, macOS 26 shows controls in Control Center and the menu bar, from Mac apps, Catalyst apps or iOS apps on Apple silicon. watchOS 26 shows them in Control Center, on the Apple Watch Ultra Action button and in the Smart Stack, from a watch app or the paired iPhone app. The control APIs are marked macOS 26 and watchOS 26 in Apple’s documentation, so no extra code is needed for an iPhone control to appear there, but check how your symbol and title read on the watch.
Traps
- Toggle state from the toggle itself.
currentValue()must read the real state, not a cached flag the intent sets. Otherwise the control lies after the app changes state. - Forgetting the reload. Any state change outside the control needs
reloadControls(ofKind:). OpenIntentin only one target. The control appears but the app does not open.- Slow
currentValue(). The system calls it on every render. Read local storage; refresh from the server elsewhere. - No authentication on destructive actions. The Lock Screen makes every control one press away.
- Unclear symbols. At the smallest size, the symbol is all people see.
Checklist
| Need | API | Minimum |
|---|---|---|
| Action | ControlWidgetButton + AppIntent |
iOS 18 |
| Open a screen | ControlWidgetButton + OpenIntent |
iOS 18 |
| On/off state | ControlWidgetToggle + SetValueIntent + ControlValueProvider |
iOS 18 |
| Person picks a target | AppIntentControlConfiguration, ControlConfigurationIntent |
iOS 18 |
| Ask on add | promptsForUserConfiguration() |
iOS 18 |
| Refresh from app | ControlCenter.shared.reloadControls(ofKind:) |
iOS 18 |
| Refresh from server | ControlPushHandler |
iOS 18 |
| Lock safety | authenticationPolicy, privacySensitive() |
iOS 18 |
| Mac and Apple Watch | Same control, no extra code | macOS 26, watchOS 26 |
Try every control from Control Center, the Lock Screen and the Action button, both unlocked and locked, before you ship. The Action button hint text is the piece teams most often forget to read.
Sources and further reading
- Creating controls to perform actions across the system Apple Developer Documentation
- Adding refinements and configuration to controls Apple Developer Documentation
- Displaying live data with Live Activities Apple Developer Documentation
- What's new in widgets Apple, WWDC25
- iOS and iPadOS 18: The MacStories Review Federico Viticci, MacStories
- Integrating App Intents with Control Action Antonella Giugliano, Create with Swift
- App Intent driven development in Swift and SwiftUI Antoine van der Lee, SwiftLee