SHIELD an App for a certain Time

i write a function to shield the apps and another that unshield them

    func startAppRestrictions() {
        print("setShieldRestrictions")
        

        // Lock all application categories
        store.shield.applicationCategories = .all()
        store.shield.webDomainCategories = .all()

        // Prevent app removal
        store.application.denyAppRemoval = true
        print("deny app removal: ",  store.application.denyAppRemoval ?? false)
        
        // Prevent set date time
        store.dateAndTime.requireAutomaticDateAndTime = true
    }
func endAppRestrictions(){
//some code
}

i want that the shield works only for a certain time. The idea was to set a timer and call the first function and after a certain time call the other one. There is a better way to do so.

SHIELD an App for a certain Time
 
 
Q