View in English

  • Apple 开发者
    • 入门汇总

    探索“入门汇总”

    • 概览
    • 学习
    • Apple Developer Program

    及时了解最新动态

    • 最新动态
    • 开发者你好
    • 平台

    探索“平台”

    • Apple 平台
    • iOS
    • iPadOS
    • macOS
    • Apple tvOS
    • visionOS
    • watchOS
    • App Store

    精选

    • 设计
    • 分发
    • 游戏
    • 配件
    • 网页
    • Home
    • CarPlay 车载
    • 技术

    探索“技术”

    • 概览
    • Xcode
    • Swift
    • SwiftUI

    精选

    • 辅助功能
    • App Intents
    • Apple 智能
    • 游戏
    • 机器学习与 AI
    • 安全性
    • Xcode Cloud
    • 社区

    探索“社区”

    • 概览
    • “与 Apple 会面交流”活动
    • 社区主导的活动
    • 开发者论坛
    • 开源

    精选

    • WWDC
    • Swift Student Challenge
    • 开发者故事
    • App Store 大奖
    • Apple 设计大奖
    • Apple Developer Centers
    • 文档

    探索“文档”

    • 文档库
    • 技术概述
    • 示例代码
    • 《人机界面指南》
    • 视频

    发布说明

    • 精选更新
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • Apple tvOS
    • Xcode
    • 下载

    探索“下载”

    • 所有下载
    • 操作系统
    • 应用程序
    • 设计资源

    精选

    • Xcode
    • TestFlight
    • 字体
    • SF Symbols
    • Icon Composer
    • 支持

    探索“支持”

    • 概览
    • 帮助指南
    • 开发者论坛
    • “反馈助理”
    • 联系我们

    精选

    • 《开发者账户帮助》
    • 《App 审核指南》
    • 《App Store Connect 帮助》
    • 即将实行的要求
    • 协议和准则
    • 系统状态
  • 快速链接

    • 活动
    • 新闻
    • 论坛
    • 示例代码
    • 视频
 

视频

打开菜单 关闭菜单
  • 专题
  • 所有视频
  • 关于

更多视频

  • 简介
  • 概要
  • 代码
  • 使用 Image Playground 制作高质量图像

    使用 Image Playground 框架,为你的 App 启用高质量图像生成功能。借助基于专用云计算运行的全新生成式模型,用户可以在你的 App 中制作写实以及其他各种风格的图像。你还可以指定尺寸来扩展应用场景,并允许用户使用自然语言描述和触控来修改图像。了解如何采用 Image Playground 框架,基于描述和照片生成图像,并管理 App 内功能的可用性。

    章节

    • 0:00 - Introduction
    • 2:03 - Capabilities
    • 5:02 - Adopt Image Playground
    • 8:29 - Options
    • 12:15 - Availability

    资源

      • 高清视频
      • 标清视频

    相关视频

    WWDC26

    • 使用 PencilKit 解读笔触之间的奥秘
    • 通过专用云计算充分利用 [Model Name]

    WWDC24

    • 借助 Genmoji 将表情引入 App
  • 搜索此视频…
    • 5:28 - Adopt Image Playground in SwiftUI

      // Adopt Image Playground in SwiftUI
      
      func imagePlaygroundSheet(
          isPresented: Binding<Bool>,
          concepts: [ImagePlaygroundConcept] = [],
          sourceImage: Image? = nil,
          onCompletion: @escaping (URL) -> Void,
          onCancellation: (() -> Void)? = nil
      ) -> some View
    • 5:39 - Add Image Playground sheet with binding to @State

      // Adopt Image Playground
      
      @State private var showingPlayground = false
      
      var body: some View {
          Button("Create image") {
              showingPlayground = true
          }
          .imagePlaygroundSheet(
              isPresented: $showingPlayground,
              onCompletion: { url in
                  var updated = currentCard
                  store.saveImage(url, for: &updated)
              }
          )
      }
    • 6:29 - Seeding the sheet with context from your card

      // Seeding the sheet with context from your card
      
      var concepts: [ImagePlaygroundConcept] {
          [
              .text(card.theme),
              .extracted(from: card.message, title: card.theme),
          ]
      }
      
      var body: some View {
          Button("Create image") {
              showingPlayground = true
          }
          .imagePlaygroundSheet(
              isPresented: $showingPlayground,
              concepts: concepts,
              onCompletion: { url in
                  var updated = card
                  store.saveImage(url, for: &updated)
              }
          )
      }
    • 7:11 - Starting from a reference photo

      // Starting from a reference photo
      
      @State private var sourceImage: Image?
      
      var body: some View {
          Button("Create image") {
              showingPlayground = true
          }
          .imagePlaygroundSheet(
              isPresented: $showingPlayground,
              concepts: concepts,
              sourceImage: sourceImage,
              onCompletion: { url in
                  var updated = card
                  store.saveImage(url, for: &updated)
              }
          )
      }
    • 7:42 - Providing a visual suggestion using a drawing

      // Providing a visual suggestion using a drawing
      
      @State private var drawing = PKDrawing()
      
      var concepts: [ImagePlaygroundConcept] {
          var result: [ImagePlaygroundConcept] = [
              .text(card.theme),
              .extracted(from: card.message)
          ]
          if !drawing.strokes.isEmpty {
              result.append(.drawing(drawing))
          }
          return result
      }
    • 8:06 - Adopt Image Playground in UIKit or AppKit

      // Adopt Image Playground in UIKit or AppKit
      
      func presentViewController() {
          let viewController = ImagePlaygroundViewController()
          viewController.concepts = [
              .text(card.theme),
              .extracted(from: card.message)
          ]
          viewController.delegate = self
          present(viewController, animated: true)
      }
      
      func imagePlaygroundViewController(
          _ viewController: ImagePlaygroundViewController,
          didCreateImageAt url: URL
      ) {
          var updated = card
          store.saveImage(url, for: &updated)
          dismiss(animated: true)
      }
    • 9:02 - Size Specification

      // Size Specification
      
      var options: ImagePlaygroundOptions {
          var options = ImagePlaygroundOptions()
          options.sizeSpecification = .closest(to: card.format.size)
          return options
      }
      
      var body: some View {
          Button("Create image") { showingPlayground = true }
              .imagePlaygroundSheet(
                  isPresented: $showingPlayground,
                  concepts: concepts,
                  onCompletion: { url in
                      var updated = card
                      store.saveImage(url, for: &updated)
                  }
              )
              .imagePlaygroundOptions(options)
      }
    • 9:39 - Styles

      // Styles
      
      var options: ImagePlaygroundOptions {
          var options = ImagePlaygroundOptions()
          options.sizeSpecification = .closest(to: card.format.size)
          return options
      }
      
      var body: some View {
          Button("Create image") { showingPlayground = true }
              .imagePlaygroundSheet(
                  isPresented: $showingPlayground,
                  concepts: concepts,
                  onCompletion: { url in
                      var updated = card
                      store.saveImage(url, for: &updated)
                  }
              )
              .imagePlaygroundOptions(options)
              .imagePlaygroundGenerationStyle(
                  pendingStylePreset.defaultStyle,
                  in: pendingStylePreset.allowedStyles
              )
      }
    • 10:27 - External Provider Style

      // External Provider Style
      
      var options: ImagePlaygroundOptions {
          var options = ImagePlaygroundOptions()
          options.sizeSpecification = .closest(to: card.format.size)
          return options
      }
      
      var body: some View {
          Button("Create image") { showingPlayground = true }
              .imagePlaygroundSheet(
                  isPresented: $showingPlayground,
                  concepts: concepts,
                  onCompletion: { url in
                      var updated = card
                      store.saveImage(url, for: &updated)
                  }
              )
              .imagePlaygroundOptions(options)
              .imagePlaygroundGenerationStyle(
                  pendingStylePreset.defaultStyle,
                  in: pendingStylePreset.allowedStyles + [.externalProvider]
              )
      }
    • 11:02 - Generating an expressive icon for the card thumbnail

      // Generating an expressive icon for the card thumbnail
      
      @State private var showingIconPlayground = false
      
      var body: some View {
          Button("Create icon") {
              showingIconPlayground = true
          }
          Color.clear
              .imagePlaygroundSheet(
                  isPresented: $showingIconPlayground,
                  concepts: concepts,
                  onCompletion: { _ in
                  } ,
                  onAdaptiveImageGlyphCreation: { glyph in
                      var updatedCard = card
                      store.saveIcon(glyph, for: &updatedCard)
                  }
              )
              .imagePlaygroundGenerationStyle(.emoji, in: [.emoji])
      }
    • 12:01 - Disabling personalization when it doesn't fit your context

      // Disabling personalization when it doesn't fit your context
      
      var options: ImagePlaygroundOptions {
          var options = ImagePlaygroundOptions()
          options.sizeSpecification = .closest(to: card.format.size)
          options.personalization = .disabled
          return options
      }
    • 12:32 - Supports image generation

      // Supports image generation
      
      @Environment(\.supportsImageGeneration)
      private var supportsImageGeneration
      
      var body: some View {
          NavigationLink(card.recipient) {
              if supportsImageGeneration {
                  CardEditorView(card: card)
              }γelse {
                  CardPickerView(card: card)
              }
          }
      }
    • 0:00 - Introduction
    • The ImagePlayground framework brings high-quality, true-to-life image creation into your app, on devices with Apple Intelligence support.

    • 2:03 - Capabilities
    • Image Playground enables the creation of high-quality images with people, styles, and different aspect ratios.

    • 5:02 - Adopt Image Playground
    • Present the Image Playground sheet and seed it with context from your app.

    • 8:29 - Options
    • Configure the Image Playground sheet with options like size, style, and personalization.

    • 12:15 - Availability
    • Ensure your app gracefully handles both supported and unsupported devices, presenting the full Image Playground experience when available.

Developer Footer

  • 视频
  • WWDC26
  • 使用 Image Playground 制作高质量图像
  • 打开菜单 关闭菜单
    • iOS
    • iPadOS
    • macOS
    • Apple tvOS
    • visionOS
    • watchOS
    打开菜单 关闭菜单
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • SF Symbols
    打开菜单 关闭菜单
    • 辅助功能
    • 配件
    • Apple 智能
    • App 扩展
    • App Store
    • 音频与视频 (英文)
    • 增强现实
    • 设计
    • 分发
    • 教育
    • 字体 (英文)
    • 游戏
    • 健康与健身
    • App 内购买项目
    • 本地化
    • 地图与位置
    • 机器学习与 AI
    • 开源资源 (英文)
    • 安全性
    • Safari 浏览器与网页 (英文)
    打开菜单 关闭菜单
    • 完整文档 (英文)
    • 部分主题文档 (简体中文)
    • 教程
    • 下载
    • 论坛 (英文)
    • 视频
    打开菜单 关闭菜单
    • 支持文档
    • 联系我们
    • 错误报告
    • 系统状态 (英文)
    打开菜单 关闭菜单
    • Apple 开发者
    • App Store Connect
    • 证书、标识符和描述文件 (英文)
    • 反馈助理
    打开菜单 关闭菜单
    • 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 (英文)
    打开菜单 关闭菜单
    • 与 Apple 会面交流
    • Apple Developer Center
    • App Store 大奖 (英文)
    • Apple 设计大奖
    • Apple Developer Academies (英文)
    • WWDC
    阅读最近新闻。
    获取 Apple Developer App。
    版权所有 © 2026 Apple Inc. 保留所有权利。
    使用条款 隐私政策 协议和准则