Managed Settings shield website using a list of urls

Hello! Rookie Swift developer here!

I am trying to make an app that uses the Screen Time API to block a list of websites. Specifically, I want it to take a list of web domains in String format and restrict them instead of using the FamilyActivityPicker. So far, I have been unsuccessful.

When using the FamilyActivityPicker, I have been able to restrict websites by modifying the shield instance variable of the ManagedSettingsStore.

let store = ManagedSettingsStore()

// Got selection from familyActivityPicker.
store.shield.webDomains = selection.webDomainTokens

"store.shield.webDomains" is of type "Set<Token<WebDomain>>" and as far as I know, you can create a WebDomain struct with a String url but not Token<WebDomain>. I was only able to get a token using the FamilyActivityPicker.

Hence, I was wondering if it was even possible to do this and if so, how you'd go about it. Thanks!

Accepted Answer
Managed Settings shield website using a list of urls
 
 
Q