Where do I add ShieldConfiguration ?

I am creating a custom shield UI for when an app is blocked. have an AppDelegate file where my @UIApplicationMain is run

I pasted in the ShieldConfiguration code from the WWDC21 Meet Screen Time demo inside my app:

class MyShieldConfiguration: ShieldConfigurationDataSource {
    override func configuration(shielding application: Application) -> ShieldConfiguration {
        return ShieldConfiguration(
            title: ShieldConfiguration.Label(text: "Doxo", color: UIColor.blue),
            subtitle: ShieldConfiguration.Label(text: "heyhey")
            
        )
    }
}

but after calling store.shield.applications = .... the default restricted screen is being shown instead of the one I configured above

Where am I supposed to put MyShieldConfiguration ?

Answered by DanteDoxo in 760450022

Okay we figured it out. You have to add it as an extension from targets, not just declare it an class somewhere

Accepted Answer

Okay we figured it out. You have to add it as an extension from targets, not just declare it an class somewhere

Is there any chance you could share example project? I have no idea why, but my shield configuration extension code never gets executed. I've seen others struggle with the same issue as well.

So it turns out it was my iOS 16.1 device that was failing to render shield properly. 16.4 simulator worked fine and as soon as I updated my device to now latest 16.6 it immediatelly started working.

Where do I add ShieldConfiguration ?
 
 
Q