Screen Time API: how to customize a cover shield in Xcode 14?

Hi all. I've tried to use Screen Time API from WWDC video https://developer.apple.com/videos/play/wwdc2021/10123/ .

In Xcode 14, there is no longer available ShieldConfigurationProvider and ShieldActionHandler from the video.

Instead of them we have ShieldActionDelegate and ShieldConfigurationDataSource, but there is no examples and details how to use them.

In documentation (links are below) we can see only "create an extension to customize the appearance of the shields" and "Subclass Shield ActionDelegate". I have tried to create extensions but they weren't triggered. I have created subclasses also but It wasn't work and I didn't found any possibility to set custom ShieldConfiguration somewhere

https://developer.apple.com/documentation/managedsettingsui/shieldconfigurationdatasource?changes=311 https://developer.apple.com/documentation/managedsettings/shieldactiondelegate

So, does anyone had success to customizing ShieldConfiguration in Xcode 14? How did you do this? Should I add something to Info.plist file according to https://developer.apple.com/forums/thread/683110? I already have there

	<key>NSExtension</key>
	<dict>
		<key>NSExtensionPointIdentifier</key>
		<string>com.apple.deviceactivity.monitor-extension</string>
		<key>NSExtensionPrincipalClass</key>
		<string>$(PRODUCT_MODULE_NAME).MyDeviceActivityMonitor</string>
	</dict>

I would be grateful for any help and advice, thank you)

Answered by Frameworks Engineer in 732780022

In Xcode, select File > New > Target... > iOS > Shield Action Extension and Xcode will create a simple, correctly configured extension target (with all of the relevant Info.plist keys) that you can then modify to fit your app's use case. You can do the same for a shield configuration extension by selecting File > New > Target... > iOS > Shield Configuration Extension.

Accepted Answer

In Xcode, select File > New > Target... > iOS > Shield Action Extension and Xcode will create a simple, correctly configured extension target (with all of the relevant Info.plist keys) that you can then modify to fit your app's use case. You can do the same for a shield configuration extension by selecting File > New > Target... > iOS > Shield Configuration Extension.

Screen Time API: how to customize a cover shield in Xcode 14?
 
 
Q