Turn my iPhone to silent mode via Code (Swift)

Hi All,


I am working on a project to turn my iPhone to silent mode via Code (Swift), Can someone ,plz, help to put on the right direction as I am very new to Xcode and Swift.


Regards

Not possible - only the user can activate do-not-disturb/silent modes.

During testing on iOS 18.7.3, I observed an existing App Store application that, upon entering a geofenced region, caused the iPhone to display the Silent Mode (bell-with-slash) indicator. The Ringtone & Alerts slider remained unchanged, incoming cellular calls vibrated without ringing, and timers continued to sound normally. I am not asking how that application is implemented; I am only asking whether there is any current public, documented, App Store-approved mechanism available to newly submitted applications to achieve equivalent behavior.

Turn my iPhone to silent mode via Code (Swift)
 
 
Q