View in English

  • Apple Developer
    • Get Started

    Explore Get Started

    • Overview
    • Learn
    • Apple Developer Program

    Stay Updated

    • Latest News
    • Hello Developer
    • Platforms

    Explore Platforms

    • Apple Platforms
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    Featured

    • Design
    • Distribution
    • Games
    • Accessories
    • Web
    • Home
    • CarPlay
    • Technologies

    Explore Technologies

    • Overview
    • Xcode
    • Swift
    • SwiftUI

    Featured

    • Accessibility
    • App Intents
    • Apple Intelligence
    • Games
    • Machine Learning & AI
    • Security
    • Xcode Cloud
    • Community

    Explore Community

    • Overview
    • Meet with Apple events
    • Community-driven events
    • Developer Forums
    • Open Source

    Featured

    • WWDC
    • Swift Student Challenge
    • Developer Stories
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Centers
    • Documentation

    Explore Documentation

    • Documentation Library
    • Technology Overviews
    • Sample Code
    • Human Interface Guidelines
    • Videos

    Release Notes

    • Featured Updates
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • Downloads

    Explore Downloads

    • All Downloads
    • Operating Systems
    • Applications
    • Design Resources

    Featured

    • Xcode
    • TestFlight
    • Fonts
    • SF Symbols
    • Icon Composer
    • Support

    Explore Support

    • Overview
    • Help Guides
    • Developer Forums
    • Feedback Assistant
    • Contact Us

    Featured

    • Account Help
    • App Review Guidelines
    • App Store Connect Help
    • Upcoming Requirements
    • Agreements and Guidelines
    • System Status
  • Quick Links

    • Events
    • News
    • Forums
    • Sample Code
    • Videos
 

Vídeos

Abrir menu Fechar menu
  • Coleções
  • Todos os vídeos
  • Sobre

Mais vídeos

  • Sobre
  • Código
  • Explore Packages and Projects with Xcode Playgrounds

    Xcode Playgrounds helps developers explore Swift and framework APIs and provides a scratchpad for rapid experimentation. Learn how Xcode Playgrounds utilizes Xcode's modern build system, provides improved support for resources, and integrates into your projects, frameworks, and Swift packages to improve your documentation and development workflow.

    Recursos

    • Fruta: Building a feature-rich app with SwiftUI
      • Vídeo HD
      • Vídeo SD

    Vídeos relacionados

    WWDC23

    • Prototype with Xcode Playgrounds

    WWDC20

    • Swift packages: Resources and localization

    WWDC19

    • Training Object Detection Models in Create ML
  • Buscar neste vídeo...
    • 8:53 - Playgrounds and resources Demo: Part 1

      import UIKit
      let image = UIImage(named: "ingredient/orange")
    • 10:18 - Playgrounds and resources Demo: Part 2

      import CoreML
      let yoloModel = try YOLOv3(configuration: MLModelConfiguration()).model
    • 10:54 - Playgrounds and resources Demo: Part 3

      import UIKit
      import CoreML
      import Vision
      
      let ingredientNames = [
          "banana",
          "orange",
          "almond-milk",
      ]
      
      let yoloModel = try YOLOv3(configuration: MLModelConfiguration()).model
      let model = try VNCoreMLModel(for: yoloModel)
      
      let request = VNCoreMLRequest(model: model) {_,_ in }
    • 11:24 - Recognized Object Visualizer

      import Foundation
      import SwiftUI
      import UIKit
      
      // MARK: Model
      
      /// The result of object detection on an image.
      public struct ObjectDetectionResult : Identifiable {
          public var name: String
          public var image: UIImage
          public var id: String
          public var objects: [RecognizedObject]
      
          public init(name: String, image: UIImage, id: String, objects: [RecognizedObject]) {
              self.id = id
              self.name = name
              self.image = image
              self.objects = objects
          }
      }
      
      /// An object recognized by an image classifier.
      public struct RecognizedObject : Identifiable {
          public var id: Int
          public var label: String
          public var confidence: Double
          public var boundingBox: CGRect
      
          public init(id: Int, label: String, confidence: Double, boundingBox: CGRect) {
              self.id = id
              self.label = label
              self.confidence = confidence
              self.boundingBox = boundingBox
          }
      }
      
      // MARK: Views
      
      public struct RecognizedObjectVisualizer : View {
          public var results: [ObjectDetectionResult]
          public var imageSize: CGFloat = 400
      
          public init(withResults results: [ObjectDetectionResult]) {
              self.results = results
          }
      
          public var body: some View {
              List(results) { result in
                  Spacer()
      
                  VStack(alignment: .center) {
                      RecognizedObjectsView(
                          image: result.image,
                          objects: result.objects
                      )
                      .frame(width: imageSize, height: imageSize)
      
                      Text(result.name.capitalized)
      
                      Spacer(minLength: 20)
                  }
      
                  Spacer()
              }
          }
      }
      
      struct RecognizedObjectsView : View {
          var image: UIImage
          var objects: [RecognizedObject]
      
          var body: some View {
              GeometryReader { geometry in
                  Image(uiImage: image)
                      .resizable()
                      .overlay(
                          ZStack {
                              ForEach(objects) { object in
                                  Rectangle()
                                      .stroke(Color.red)
                                      .shadow(radius: 2.0)
                                      .frame(
                                          width: object.boundingBox.width * geometry.size.width / image.size.width,
                                          height: object.boundingBox.height * geometry.size.height / image.size.height
                                      )
                                      .position(
                                          x: (object.boundingBox.origin.x + object.boundingBox.size.width / 2.0) * geometry.size.width / image.size.width,
                                          y: geometry.size.height - (object.boundingBox.origin.y + object.boundingBox.size.height / 2.0) * geometry.size.height / image.size.height
                                      )
                                      .overlay(
                                          Text("\(object.label.capitalized) (\(String(format: "%0.0f", object.confidence * 100.0))%)")
                                              .foregroundColor(Color.red)
                                              .position(
                                                  x: (object.boundingBox.origin.x + object.boundingBox.size.width / 2.0) * geometry.size.width / image.size.width,
                                                  y: geometry.size.height - (object.boundingBox.origin.y - 20.0) * geometry.size.height / image.size.height
                                              )
                                      )
                              }
                          }
                      )
              }
          }
      }
    • 11:48 - Playgrounds and resources Demo: Part 4

      let results = ingredientNames.compactMap { ingredient -> ObjectDetectionResult? in
      
          guard let image = UIImage(named: "ingredient/\(ingredient)") else { return nil }
      
          let handler = VNImageRequestHandler(cgImage: image.cgImage!)
          try? handler.perform([request])
          let observations = request.results as! [VNRecognizedObjectObservation]
      
          let detectedObjects = observations.enumerated().map { (index, observation) -> RecognizedObject in
      
              // Select only the label with the highest confidence.
              let topLabelObservation = observation.labels[0]
              let objectBounds = VNImageRectForNormalizedRect(observation.boundingBox, Int(image.size.width), Int(image.size.height))
      
              return RecognizedObject(id: index, label: topLabelObservation.identifier, confidence: Double(topLabelObservation.confidence), boundingBox: objectBounds)
          }
      
          return ObjectDetectionResult(name: ingredient, image: image, id: ingredient, objects: detectedObjects)
      }
      
      results
    • 12:33 - Playgrounds and resources Demo: Part 5

      import PlaygroundSupport
      
      PlaygroundPage.current.setLiveView(
          RecognizedObjectVisualizer(withResults: results)
              .frame(width: 500, height: 800)
      )

Developer Footer

  • Vídeos
  • WWDC20
  • Explore Packages and Projects with Xcode Playgrounds
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • Apple Intelligence
    • Audio & Video
    • Augmented Reality
    • Business
    • Design
    • Distribution
    • Education
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning & AI
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Downloads
    • Sample Code
    • Videos
    Open Menu Close Menu
    • Help Guides & Articles
    • Contact Us
    • Forums
    • Feedback & Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • 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 Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Read the latest news.
    Get the Apple Developer app.
    Copyright © 2026 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines