Hi everyone,
Is there any way to detect an app is being mirrored from an iPhone to macOS via iPhone Mirroring (new feature from iOS18 and macOS 15 Sequoia)?
My app has a business requirement to disable screen mirroring and recording (or just display a black screen when it's active). However, the current implementation doesn't seem to work with iPhone Mirroring to macOS. Is there any solution for this? Because as far as I know, seems like there is no API to detect it
What I've tried so far
1. Count the UIScreen
var totalScreens = UIScreen.screens.count
Screen counts:
- iPhone only (without mirroring or airplay): 1
- iPhone Airplay (screen mirroring): 2
- iPhone Mirroring (iOS18) to MacOS15: 1
conclusion: both iPhone only and iPhone mirroring to macOS returns the same screen count (no difference)
2. Mask the entire screen with passwordTextField.isSecureTextEntry= true
Result
- iPhone screen recording: Black screen
- iPhone screen mirroring (AirPlay): Black screen
- iPhone Mirroring (with macOS): No blackscreen, it works as usual
The implementation is similar to https://stackoverflow.com/a/67054892 and https://forums.developer.apple.com/forums/thread/736112?answerId=765331022#765331022
What I want to achieve is something like the FairPlay Streaming API (https://developer.apple.com/streaming/fps/), where it turns the screen black when a screenshot, screen recording, screen mirroring, or iPhone mirroring is active.
Thank you