View in English

  • Apple Developer
    • 今すぐ始める

    「今すぐ始める」を詳しく見る

    • 概要
    • 学ぶ
    • Apple Developer Program

    最新情報

    • 最新ニュース
    • Hello Developer
    • プラットフォーム

    プラットフォームを詳しく見る

    • Appleプラットフォーム
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    特集

    • デザイン
    • 配信
    • ゲーム
    • アクセサリ
    • Web
    • Home
    • CarPlay
    • テクノロジー

    テクノロジーを詳しく見る

    • 概要
    • Xcode
    • Swift
    • SwiftUI

    特集

    • アクセシビリティ
    • App Intent
    • Apple Intelligence
    • ゲーム
    • 機械学習とAI
    • セキュリティ
    • Xcode Cloud
    • コミュニティ

    コミュニティを詳しく見る

    • 概要
    • 「Appleに相談」イベント
    • コミュニティによるイベント
    • デベロッパフォーラム
    • オープンソース

    特集

    • WWDC
    • Swift Student Challenge
    • デベロッパストーリー
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Center
    • ドキュメント

    ドキュメントを詳しく見る

    • ドキュメントライブラリ
    • テクノロジー概要
    • サンプルコード
    • ヒューマンインターフェイスガイドライン
    • ビデオ

    リリースノート

    • 注目のアップデート
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • ダウンロード

    ダウンロードを詳しく見る

    • すべてのダウンロード
    • オペレーティングシステム
    • アプリ
    • デザインリソース

    特集

    • Xcode
    • TestFlight
    • フォント
    • SF Symbols
    • Icon Composer
    • サポート

    サポートを詳しく見る

    • 概要
    • ヘルプガイド
    • デベロッパフォーラム
    • フィードバックアシスタント
    • お問い合わせ

    特集

    • アカウントヘルプ
    • App Reviewガイドライン
    • App Store Connectヘルプ
    • 近日導入予定の要件
    • 契約およびガイドライン
    • システムステータス
  • クイックリンク

    • イベント
    • ニュース
    • Forum
    • サンプルコード
    • ビデオ
 

ビデオ

メニューを開く メニューを閉じる
  • コレクション
  • すべてのビデオ
  • 利用方法

その他のビデオ

  • 概要
  • Summary
  • コード
  • ライブアクティビティの基本

    ライブアクティビティを活用してアプリの利用体験を向上させましょう。ライブアクティビティを表示できる場所は多数ありますが、Dynamic Islandの新しいスタイルとして、iPhoneを横向きで使用する際にさらに多くの情報を表示するスタイルが追加されました。ActivityKitとプッシュ通知を使用して、スペースごとのライブアクティビティの調整、コンテンツとデータの構造化、プロセス全体を通じたリアルタイムのアップデートを行う方法を紹介します。

    関連する章

    • 0:01 - Introduction
    • 1:53 - Create and update
    • 9:51 - Optimize

    リソース

    • Human Interface Guidelines: Live Activities
    • Starting and updating Live Activities with ActivityKit push notifications
    • ActivityKit
      • HDビデオ
      • SDビデオ

    関連ビデオ

    WWDC24

    • Apple Watchでのライブアクティビティの表示
    • SwiftUIの基本

    WWDC23

    • ダイナミックなライブアクティビティのデザイン
  • このビデオを検索
    • 4:16 - Define initial Live Activity

      // Define initial Live Activity.
      
      import ActivityKit
      import Foundation
      
      public struct DrinkOrderAttributes: ActivityAttributes {
          let shopName: String
          let drink: Drink
          let orderID: UUID
      
          public struct ContentState: Codable, Hashable {
              var phase: DrinkOrder.Phase = .waiting
              var estimatedReadyDate: Date
              var rating: DrinkOrder.Rating?
          }
      }
    • 5:35 - Create each Live Activity view

      // Create each Live Activity view
      
      import ActivityKit
      import SwiftUI
      import WidgetKit
      
      struct DrinkOrderLiveActivity: Widget {
          var body: some WidgetConfiguration {
              ActivityConfiguration(for: DrinkOrderAttributes.self) { context in
                  ActivityView(context: context)
              } dynamicIsland: { context in
                  DynamicIsland {
                      DynamicIslandExpandedRegion(.leading) {
                          ExpandedLeadingView(context: context)
                      }
                      DynamicIslandExpandedRegion(.center) {
                          ExpandedCenterView(context: context)
                      }
                      DynamicIslandExpandedRegion(.trailing) {
                          ExpandedTrailingView(context: context)
                      }
                      DynamicIslandExpandedRegion(.bottom) {
                          ExpandedBottomView(context: context)
                      }
                  } compactLeading: {
                      CompactLeadingView(context: context)
                  } compactTrailing: {
                      CompactTrailingView(context: context)
                  } minimal: {
                      MinimalView(context: context)
                  }
              }
          }
      }
    • 7:43 - Start and update a Live Activity

      // Start a Live Activity
      
      func launchLiveActivity(order: DrinkOrder) throws {
          guard ActivityAuthorizationInfo().areActivitiesEnabled else { return }
          let attributes = DrinkOrderAttributes(shopName: "Coffee Shop", drink: order.drink, orderID: order.id)
          let estimatedReadyDate = Date.now + (15 * 60)
          let contentState = DrinkOrderAttributes.ContentState(phase: .waiting, estimatedReadyDate: estimatedReadyDate)
          let activityContent = ActivityContent(state: contentState, staleDate: nil)
          let activity = try Activity.request(attributes: attributes, content: activityContent)
      
      }
      
      // Update a Live Activity
      
      await activity.update(
          ActivityContent(
              state: DrinkOrderAttributes.ContentState(
                  phase: .preparing,
                  estimatedReadyDate: estimatedReadyDate
              ),
              staleDate: nil
          )
      )
    • 10:33 - Optimize for limited width in the Dynamic Island

      // Optimize for limited width in the Dynamic Island
      
      struct CompactTrailingView: View {
          @Environment(\.isDynamicIslandLimitedInWidth) var isDynamicIslandLimitedInWidth
          var context: ActivityViewContext<DrinkOrderAttributes>
          var body: some View {
              if isDynamicIslandLimitedInWidth {
                  StepProgressIconView(context: context)
              } else if context.state.phase.showsTimer {
                  EstimatedReadyView(context: context, font: .system(.body).monospacedDigit())
                      .multilineTextAlignment(.trailing)
                      .frame(maxWidth: maximumTimerLabelWidth)
              } else {
                  OrderPhaseLabelView(context: context, font: .caption2.bold(), color: .brown)
                      .multilineTextAlignment(.trailing)
              }
          }
      }
    • 11:34 - Extend background color in StandBy

      // Extend background color in StandBy
      
      struct ActivityView: View {
      
          @Environment(\.showsWidgetContainerBackground) var showsWidgetContainerBackground
          var context: ActivityViewContext<DrinkOrderAttributes>
      
          var body: some View {
              DetailView(context: context)
                  .background {
                      if showsWidgetContainerBackground {
                          LinearGradient.barista
                      }
                  }
                  .activityBackgroundTint(.espresso)
          }
      }
    • 12:30 - Add support for activityFamily small

      // Add support for activityFamily small
      
      import ActivityKit
      import SwiftUI
      import WidgetKit
      
      struct DrinkOrderLiveActivity: Widget {
          var body: some WidgetConfiguration {
              ActivityConfiguration(for: DrinkOrderAttributes.self) { context in
                  ActivityView(context: context)
              } dynamicIsland: { context in
                  DynamicIsland {
                      DynamicIslandExpandedRegion(.leading) {
                          ExpandedLeadingView(context: context)
                      }
                      DynamicIslandExpandedRegion(.center) {
                          ExpandedCenterView(context: context)
                      }
                      DynamicIslandExpandedRegion(.trailing) {
                          ExpandedTrailingView(context: context)
                      }
                      DynamicIslandExpandedRegion(.bottom) {
                          ExpandedBottomView(context: context)
                      }
                  } compactLeading: {
                      CompactLeadingView(context: context)
                  } compactTrailing: {
                      CompactTrailingView(context: context)
                  } minimal: {
                      MinimalView(context: context)
                  }
              }
              .supplementalActivityFamilies([.small])
          }
      }
    • 12:43 - Optimize for small family

      // Optimize for small family
      
      struct ActivityView: View {
          @Environment(\.showsWidgetContainerBackground) var showsWidgetContainerBackground
          @Environment(\.activityFamily) var activityFamily
      
          var context: ActivityViewContext<DrinkOrderAttributes>
      
          var body: some View {
              contentView
                  .background {
                      if showsWidgetContainerBackground {
                          LinearGradient.barista
                      }
                  }
                  .activityBackgroundTint(.espresso)
          }
      
          @ViewBuilder
          var contentView: some View {
              if activityFamily == .small {
                  SmallView(context: context)
              } else {
                  DetailView(context: context)
              }
          }
      }
    • 13:36 - Add interactivity with App Intents

      // Add interactivity with App Intents
      
      struct RateDrinkIntent: LiveActivityIntent {
          static var title: LocalizedStringResource = "Rate Drink"
      
          @Parameter(title: "Order ID")
          var orderID: String
      
          @Parameter(title: "Positive")
          var isPositive: Bool
      
          func perform() async throws -> some IntentResult {
              await updateLocalDatastore(rating: isPositive ? .great : .poor, dismissPolicy: .after(.now + 15))
              return .result()
          }
      }
    • 14:06 - Associate an intent with a button

      // Associate an intent with a button
      
      struct RatingButtons: View {
          var context: ActivityViewContext<DrinkOrderAttributes>
          var body: some View {
              HStack(spacing: 12) {
                  Button(intent: RateDrinkIntent(
                      orderID: context.attributes.orderID.uuidString, isPositive: false)) {
                      Label("Not Good", systemImage: "hand.thumbsdown.fill")
                  }
                  .buttonStyle(RatingButtonStyle(color: .red))
      
                  Button(intent: RateDrinkIntent(
                      orderID: context.attributes.orderID.uuidString, isPositive: true)) {
                      Label("Great", systemImage: "hand.thumbsup.fill")
                  }
                  .buttonStyle(RatingButtonStyle(color: .green))
              }
          }
      }
    • 0:01 - Introduction
    • Live Activities keep people up-to-date about ongoing tasks or events with progressing information over time, appearing on the Lock Screen, in the Dynamic Island, on Apple Watch, and on the CarPlay Dashboard.

    • 1:53 - Create and update
    • Start by defining an efficient data model using ActivityAttributes for static data and ContentState for dynamic data. Construct tailored UI for each presentation and manage the activity's lifecycle locally via ActivityKit or remotely using push notifications.

    • 9:51 - Optimize
    • Refine the Live Activity experience by adapting layouts to accommodate specific constraints, such as limited width in the Dynamic Island in landscape, or adopting the small activity family for Apple Watch. Integrate App Intents to let people perform quick, contextual actions.

Developer Footer

  • ビデオ
  • WWDC26
  • ライブアクティビティの基本
  • メニューを開く メニューを閉じる
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • SF Symbols
    メニューを開く メニューを閉じる
    • アクセシビリティ
    • アクセサリ
    • Apple Intelligence
    • App Extension
    • App Store
    • オーディオとビデオ(英語)
    • 拡張現実
    • デザイン
    • 配信
    • 教育
    • フォント(英語)
    • ゲーム
    • ヘルスケアとフィットネス
    • アプリ内課金
    • ローカリゼーション
    • マップと位置情報
    • 機械学習とAI
    • オープンソース(英語)
    • セキュリティ
    • SafariとWeb(英語)
    メニューを開く メニューを閉じる
    • 英語ドキュメント(完全版)
    • 日本語ドキュメント(一部トピック)
    • チュートリアル
    • ダウンロード
    • フォーラム(英語)
    • ビデオ
    Open Menu Close Menu
    • サポートドキュメント
    • お問い合わせ
    • バグ報告
    • システム状況(英語)
    メニューを開く メニューを閉じる
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles(英語)
    • フィードバックアシスタント
    メニューを開く メニューを閉じる
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program(英語)
    • Mini Apps Partner Program
    • News Partner Program(英語)
    • Video Partner Program(英語)
    • セキュリティ報奨金プログラム(英語)
    • Security Research Device Program(英語)
    Open Menu Close Menu
    • Appleに相談
    • Apple Developer Center
    • App Store Awards(英語)
    • Apple Design Awards
    • Apple Developer Academy(英語)
    • WWDC
    最新ニュースを読む。
    Apple Developerアプリを入手する。
    Copyright © 2026 Apple Inc. All rights reserved.
    利用規約 プライバシーポリシー 契約とガイドライン