how do i investigate hangs in the app?
Asked on 06/16/2025
1 search
To investigate hangs in your app, you can use several tools and techniques presented at WWDC sessions:
-
Instruments in Xcode: Instruments is a powerful tool for profiling and diagnosing performance issues, including hangs. You can use the Hangs instrument to track your app's responsiveness and identify blocking behaviors. The session Optimize CPU performance with Instruments discusses using the System Trace instrument to analyze blocking behaviors between threads and the specialized Hangs instrument for issues impacting the UI or main thread.
-
SwiftUI Instrument: If your app uses SwiftUI, the updated SwiftUI instrument can help you assess performance issues. It includes lanes like Update Groups, Long View Body Updates, and Other Long Updates to identify when SwiftUI work is taking too long, which might contribute to hangs. You can learn more about this in the session Optimize SwiftUI performance with Instruments.
-
Concurrency and Main Thread Management: If your app's main thread is blocked by expensive tasks, consider offloading work to background threads using Swift concurrency. The session Code-along: Elevate an app with Swift concurrency provides insights into running tasks on a background thread to prevent hangs.
-
Thread Performance Checker: Xcode's thread performance checker can help identify main thread hangs and priority inversions. This tool is part of the updates in Xcode 16, as discussed in the session What’s new in Xcode 16.
By using these tools and techniques, you can effectively investigate and resolve hangs in your app, improving its performance and user experience.

Optimize SwiftUI performance with Instruments
Discover the new SwiftUI instrument. We’ll cover how SwiftUI updates views, how changes in your app’s data affect those updates, and how the new instrument helps you visualize those causes and effects. To get the most out of this session, we recommend being familiar with writing apps in SwiftUI.

Code-along: Elevate an app with Swift concurrency
Learn how to optimize your app’s user experience with Swift concurrency as we update an existing sample app. We’ll start with a main-actor app, then gradually introduce asynchronous code as we need to. We’ll use tasks to optimize code running on the main actor, and discover how to parallelize code by offloading work to the background. We’ll explore what data-race safety provides, and work through interpreting and fixing data-race safety errors. Finally, we’ll show how you can make the most out of structured concurrency in the context of an app.

Optimize CPU performance with Instruments
Learn how to optimize your app for Apple silicon with two new hardware-assisted tools in Instruments. We’ll start by covering how to profile your app, then dive deeper by showing every single function called with Processor Trace. We’ll also discuss how to use CPU Counters’ modes to analyze your code for CPU bottlenecks.