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
 

Videos

Open Menu Close Menu
  • Collections
  • All Videos
  • About

More Videos

  • About
  • Summary
  • Code
  • Meet the new MetricKit

    Find and fix performance problems faster than ever. Join us to explore how MetricKit equips you with vital performance metrics and actionable diagnostics to help you understand exactly where your app has opportunities for improvements. We'll also cover how to intersect your app's metrics and diagnostics by app state by using the StateReporting framework, providing you with the full picture to investigate optimizations in your app's experience.

    Chapters

    • 0:01 - Introduction
    • 4:07 - Metrics
    • 7:13 - Diagnostics
    • 10:03 - Context

    Resources

    • Getting started with StateReporting
    • Analyzing app performance with MetricKit
    • Monitoring app performance with MetricKit
    • Track performance by app state using MetricKit
    • MetricKit
      • HD Video
      • SD Video

    Related Videos

    WWDC26

    • Find and fix performance issues in your Metal games
    • Profile, fix, and verify: Improve app responsiveness with Instruments
  • Search this video…
    • 4:59 - Receive metrics from MetricKit

      // Receive metrics from MetricKit
      
      import MetricKit
      
      let manager = MetricManager()
      
      for await report in manager.metricReports {
          processReport(report)
      }
    • 5:25 - Send your metrics to the server

      // Send your metrics to the server
      
      import MetricKit
      
      for await report in manager.metricReports {
          let jsonData = try JSONEncoder().encode(report)
          sendToServer(jsonData)
      }
    • 5:44 - Access your performance metrics

      // Access your performance metrics
      
      import MetricKit
      
      for await report in manager.metricReports {
          let intervalEntries = report.intervalEntries
          let fullDayEntry = intervalEntries.fullDayEntry
          
          for entry in intervalEntries {
              let memoryMetrics = entry.values.filter { $0.metricGroup == .memory }
              
              for metric in memoryMetrics {
                  switch metric {
                  case .peakMemory(let peak):
                      processPeakMemory(peak)
                  default: break
                  }
              }
          }
      }
    • 8:59 - Receive diagnostics

      // Receive diagnostics
      
      import MetricKit
      
      let manager = MetricManager()
      
      for await report in manager.diagnosticReports {
          processReport(report)
      }
    • 9:14 - Send your diagnostic data to the server

      // Send your diagnostic data to the server
      
      import MetricKit
      
      for await report in manager.diagnosticReports {
          let jsonData = try JSONEncoder().encode(report)
          sendToServer(jsonData)
      }
    • 9:39 - Access your diagnostic data

      // Access your diagnostic data
      
      import MetricKit
      
      for await report in manager.diagnosticReports {
          switch report.result {
          case .crash(let crash):
              let backtrace = crash.callStackTree
              let reason = crash.terminationReason
              let category = crash.terminationCategory
              processCrash(backtrace: backtrace, reason: reason, category: category)
          case .hang(let hang):
              processHangDiagnostic(hang)
          default: break
          }
      }
    • 13:57 - Receive MetricKit data with states

      // Receive MetricKit data with states
      
      import MetricKit
      import StateReporting
      
      let domain = StateReportingDomain("com.metrickitsample.tabs")
      let manager = MetricManager(enabledStateReportingDomains: [domain])
      
      
      // Report transitions throughout the app
      
      let reporter = StateReporter.reporter(for: domain.rawValue)
      reporter.reportTransition(to: "Reports")
    • 14:21 - Define custom structured types

      // Define custom structured types
      
      import StateReporting
      
      @ReportableMetadata
      struct ViewConfiguration {
          let listSize: String
          let isSorted: Bool
      }
      
      let reporter = StateReporter.reporter(
          for: domain.rawValue,
          stableMetadata: ViewConfiguration.self
      )
      
      reporter.reportTransition(
          to: "Reports",
          stableMetadata: ViewConfiguration(listSize: "large", isSorted: false)
      )
    • 15:29 - Send encoded metric reports to the server

      // Send encoded metric reports to the server
      
      import MetricKit
      
      for await report in manager.metricReports {
          let encoder = JSONEncoder()
          
          let formatKey = MetricReport.encodingFormatKey
          encoder.userInfo[formatKey] = MetricReport.EncodingFormat.byStateReportingDomain
          
          let jsonData = try encoder.encode(report)
          sendToServer(jsonData)
      }
    • 0:01 - Introduction
    • MetricKit is a framework that provides metrics and diagnostics for monitoring real-world app performance. In iOS 27, the framework has been rebuilt from the ground up with a new Swift-first API and new features including Metal frame rate metrics, memory exception diagnostics, and granular data with state reporting.

    • 4:07 - Metrics
    • MetricKit delivers daily reports containing performance metrics — including launch time, hangs, CPU, memory, organized into interval entries and metric groups. Metrics can be retrieved as Codable reports for server-side aggregation or inspected directly by filtering for specific groups and values.

    • 7:13 - Diagnostics
    • When an app encounters a crash, hang, or other failure, MetricKit captures and immediately delivers a diagnostic report containing a symbolicated backtrace and metadata such as exception type and termination reason. iOS 27 adds memory exception diagnostics and a new termination category field on crash diagnostics.

    • 10:03 - Context
    • The State Reporting framework lets apps report their active configuration or user flow as named domains and states, which then allows MetricKit to aggregate data separately for each state rather than blending them. Custom structured metadata can be attached to states using the @ReportableMetadata macro, and per-state metrics are surfaced as StateEntry values in the metric report.

Developer Footer

  • Videos
  • WWDC26
  • Meet the new MetricKit
  • 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