Testing
macOS AppKit Testing with XCTest: Unit Testing macOS Desktop Apps
macOS AppKit applications are tested with XCTest, Apple's first-party testing framework.
Testing
macOS AppKit applications are tested with XCTest, Apple's first-party testing framework.
Swift
watchOS apps have the same Xcode testing infrastructure as iOS — XCTest, the test report, and CI integration all work.
Swift
tvOS apps run on Apple TV, where the primary input is a Siri Remote rather than a touchscreen.
Swift
XCTest includes a built-in performance testing API that lets you measure how long a block of code takes and compare it against a stored baseline.
Swift
Instruments is Apple's performance analysis tool included with Xcode. It attaches to a running process — including your test target — and records CPU usage, memory allocations, and retain cycles. When tests run slowly or your app leaks memory during a test run, Instruments shows you exactly where the time
Swift
visionOS is Apple's operating system for Apple Vision Pro. It runs SwiftUI apps in an immersive spatial environment alongside traditional window-based apps.
iOS
Apple's swift-testing framework (available in Xcode 16, Swift 6) replaces XCTest's 20-year-old Objective-C heritage with a modern, macro-based API. Instead of XCTAssertEqual, you write #expect(a == b). Instead of func testSomething(), you write @Test func something(). Parameterized tests, parallel execution, and
iOS
Realm's object graph persistence is tightly coupled to its runtime — you can't just pass in a mock dictionary. Testing Realm-backed iOS code requires either an in-memory Realm configuration (fast, isolated, no file cleanup) or a purpose-built mock layer. This guide covers both approaches,
iOS
Combine's asynchronous, declarative model makes testing tricky — pipelines emit values over time, operators transform them, and errors can cancel the stream. This guide covers two approaches: the built-in XCTestExpectation pattern for simple cases, and the CombineExpectations library for ergonomic, readable publisher assertions. You'll write tests
iOS
XCUITest runs your app in a simulator — it's slow, flaky, and gives no introspection into SwiftUI internals. ViewInspector lets you unit test SwiftUI views directly: inspect the view hierarchy, find subviews by type, trigger bindings, simulate button taps, and assert on text values — all without launching a simulator.
Testing
Roughly 1 in 6 people worldwide lives with some form of disability, and on mobile, screen readers like VoiceOver are often the only viable navigation method.
Testing
visionOS introduces entirely new UI paradigms — volumetric windows, immersive spaces, eye tracking, and spatial audio — that existing iOS testing patterns don't cover. This guide walks through XCTest for visionOS, RealityKit entity hierarchy testing, SwiftUI volume and immersive space testing, eye tracking simulation in Simulator, and render budget verification.