I need to Supervised and UNSupervised my device Programmatically In Swift.
@bharti1990 Thanks very much for your question!
I looked into this, and to the best of my knowledge, it is not possible to alter your device into Supervised/UnSupervised mode programmatically. These are controls that you typically would implement using a Mobile Device Management (MDM) provider or using the Apple Configurator macOS app.
Here is a link that gives you more information on it.
I hope this helps!
All the best.
The supervised mode is basically called your Managed Device and that is achieved via setting a Provisioning Profile on the device that allows or disallows certain features.
In enterprises this profile is distributed from a MDM solution via the server and if you want to simply manage a device or a smaller number manually, you can use the Apple configurator and set the restrictions, etc.
There is another option to set the device to a managed setting for children as outlined at https://support.apple.com/en-us/HT201304
Lastly, another option to restrict a device is the Guided Access mode.
Setting any of this programatically using Swift or any other language is not possible.