use Screencapturekit to capture a specific window
Asked on 03/03/2025
1 search
To capture a specific window using ScreenCaptureKit, you can utilize the SCStream object, which allows you to receive screen and audio samples in your app. You can specify what to capture by providing an SCContentFilter to the stream. This filter can be configured to capture an entire screen or just specific windows and apps.
For more detailed guidance on using ScreenCaptureKit, you can refer to the session titled "Capture HDR content with ScreenCaptureKit" from WWDC 2024. This session covers the basics of capturing screen and audio, as well as advanced features like capturing HDR content and adding microphone output.
If you are interested in capturing HDR content specifically, you can start by configuring your stream with the appropriate properties on the SCStreamConfiguration, such as setting the dynamic range and pixel format. For capturing a specific window, you would adjust the SCContentFilter accordingly.
For more information, you can watch the session Capture HDR content with ScreenCaptureKit (01:20) which covers capturing HDR content.

Discover area mode for Object Capture
Discover how area mode for Object Capture enables new 3D capture possibilities on iOS by extending the functionality of Object Capture to support capture and reconstruction of an area. Learn how to optimize the quality of iOS captures using the new macOS sample app for reconstruction, and find out how to view the final results with Quick Look on Apple Vision Pro, iPhone, iPad or Mac. Learn about improvements to 3D reconstruction, including a new API that allows you to create your own custom image processing pipelines.

Work with windows in SwiftUI
Learn how to create great single and multi-window apps in visionOS, macOS, and iPadOS. Discover tools that let you programmatically open and close windows, adjust position and size, and even replace one window with another. We’ll also explore design principles for windows that help people use your app within their workflows.

What’s new in AppKit
Discover the latest advances in Mac app development. Get an overview of the new features in macOS Sequoia, and how to adopt them in your app. Explore new ways to integrate your existing code with SwiftUI. Learn about the improvements made to numerous AppKit controls, like toolbars, menus, text input, and more.