Screen Time | How to block/shield Safari?

How to block/shield Safari? If not possible what I can do instead? It will be great to have smth like this:

store.shield.webDomains = .all
Answered by Frameworks Engineer in 747202022

Your app can shield Safari if the user searches for it in a FamilyActivityPicker, selects it, and then your app applies the corresponding token to the shield.applications setting. Alternatively, your app can block Safari by initializing an Application with Safari's bundle identifier (i.e. "com.apple.mobilesafari") and applying it to the application.blockedApplications setting.

Accepted Answer

Your app can shield Safari if the user searches for it in a FamilyActivityPicker, selects it, and then your app applies the corresponding token to the shield.applications setting. Alternatively, your app can block Safari by initializing an Application with Safari's bundle identifier (i.e. "com.apple.mobilesafari") and applying it to the application.blockedApplications setting.

Like this?:

    let mobilesafari = Application(bundleIdentifier: "com.apple.mobilesafari")
    let mobilesafariToken = mobilesafari.token

Fetching Safari's token as above always returns nil...

Example of working solution

        let store = ManagedSettingsStore

The code below will hide Safari's icon from home screen:

        let safari = Application(bundleIdentifier: "com.apple.mobilesafari")
        let blockedApplications: Set<Application> = [safari]
        store.application.blockedApplications = blockedApplications

To display it back do this:

        store.application.blockedApplications = []
Screen Time | How to block/shield Safari?
 
 
Q