Feature

iOS Demo App Rebuilt in SwiftUI with Custom Player Engine and UI Tests

TL;DR Snapshot

The Stream Probe iOS demo app is now fully SwiftUI. UIKit is gone. The update brings a protocol-driven player engine backed by AVFoundation, a persisted settings store, a built-in HLS stream catalog, and XCUITest flows that cover the core user paths.

Share this update

Stream Probe introduces a ground-up rewrite of the iOS demo app in this update, replacing UIKit with SwiftUI and adding a proper video playback architecture, settings persistence, and automated UI test coverage.

TL;DR

The iOS demo app is no longer a UIKit prototype. It's been fully rebuilt with SwiftUI, a protocol-driven player engine backed by AVFoundation, and XCUITest flows that cover real user paths through the app.

What's New

  • SwiftUI migration: The entire app lifecycle and UI moved from UIKit to SwiftUI. Every screen is now a native SwiftUI view.
  • PlayerEngine protocol + AVPlayerEngine: Video playback is now behind a PlayerEngine protocol, with AVPlayerEngine as the concrete implementation. Easier to test, easier to swap.
  • VideoSurfaceView: A custom UIViewRepresentable wraps AVPlayerLayer so SwiftUI can host the actual video surface without hacks.
  • PlayerViewModel: Manages playback state (play, pause, seek, fullscreen) and binds cleanly to the SwiftUI views.
  • HLS stream catalog: A built-in list of HLS streams gives you something to actually debug against without needing your own test stream.
  • SettingsStore (persisted): Overlay visibility, auto-play, and loop preferences now survive app restarts. Backed by UserDefaults via a simple observable store.
  • Fullscreen player controls: Custom controls built entirely in SwiftUI, no AVPlayerViewController shortcuts.
  • XCTest + XCUITest targets: New test targets with accessibility identifiers on every meaningful UI element and automated flows covering stream selection, playback, and settings.

How to Use

  1. Open the iosApp target in Xcode.
  2. Run the app on a simulator or device running iOS 16+.
  3. Pick a stream from the catalog on the home screen.
  4. Tap fullscreen to trigger the custom player controls.
  5. Open Settings to toggle overlay, auto-play, and loop. Changes persist across launches.

To run UI tests:

xcodebuild test -scheme StreamProbeDemo -destination 'platform=iOS Simulator,name=iPhone 15'

FAQ

Why rewrite in SwiftUI instead of updating the UIKit code?

The UIKit demo was functional but hard to extend. SwiftUI gives a cleaner binding model for playback state and makes it much easier to add new screens without plumbing view controllers.

Does AVPlayerEngine still work with the Stream Probe KMP layer?

Yes. The player engine sits on top of AVFoundation and the Stream Probe probe layer wraps around it the same way it did before. The rewrite changed the demo UI, not the probe integration.

What iOS version is required?

The SwiftUI rewrite targets iOS 16+. The VideoSurfaceView uses AVPlayerLayer via UIViewRepresentable, which is stable across iOS 16 and 17.

Are the XCUITests covering Stream Probe overlay behavior?

The current UI tests cover stream selection, playback start, fullscreen toggling, and settings persistence. Overlay-specific test flows are planned for a follow-up update.