iOS 18のコントロールの作り方は?

Asked on 10/04/2024

1 search

iOS 18 introduces a new way to create controls that can be integrated across various system spaces like the control center, lock screen, and action button. These controls are built using WidgetKit, which was initially introduced in iOS 14 for creating visually rich widgets. In iOS 18, WidgetKit has been extended to support controls, allowing developers to provide quick access to their app's key actions.

To create a control in iOS 18, you can follow these steps:

  1. Define the Control: Use the new controls API to specify the type of control, a symbol, and an app intent. This will make your control available in the new controls gallery, where users can add it to their control center or assign it to the action button on their iPhone 15 Pro.

  2. Customize the Control: You can tailor the control's style using modifiers to match the action it performs. Ensure that your controls feature distinctive symbols for easy recognition.

  3. Integrate with System Spaces: Controls can be placed in the control center, lock screen, or action button, providing users with quick access to frequent tasks.

  4. Handle State Changes: Use the push notification API to handle state changes across devices, ensuring that actions performed on one device are reflected on others.

For a detailed walkthrough on building controls, you can refer to the session Extend your app’s controls across the system (02:13) which covers how to build a control, perform actions, and maintain its state.