Detect iPhone Mirroring in iOS18

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

There's no supported way for you to detect iPhone Mirroring with the APIs currently available. If you'd like us to consider adding the necessary functionality, please file an enhancement request using Feedback Assistant. Once you file the request, please post the FB number here.

If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?

@Engineer - Can you please provide a full explanation why this fundamental flaw is not being looked into? We just need a way within an API to say "IPhone Mirroring" is present and active. We don't need any other data.

When you are sharing Apps between your iPhone and MacOS surely this has an understanding on the phone that it can transition. So can we be given some APIs to help a develop know if it's active. We do not need to toggle it on or off or anything like that as we will simply disable our app whilst Screen Mirroring is active.

Detect iPhone Mirroring in iOS18
 
 
Q