3

I'm trying to use DeviceActivityEvent.

var comps = DateComponents()
comps.month = 4
let event = DeviceActivityEvent( threshold: comps)

Tried above approaches but no good. Any help/tutorial or a sample code would be appreciated. As it's a newly launched API by Apple, So there's slim to none info provided yet.

Asar
  • 71
  • 11

1 Answers1

4

These three frameworks are related,

Managed Settings Family Controls DeviceActivity

Device Activity is about running our code without launching the app. Device Activity Event are monitors that call extensions when the user reaches the threshold in a Device Activity Schedule.

You can get all the help about this from the apple WWDC2021.

Asar
  • 71
  • 11
  • I have followed all steps but in intervalDidStart() of DeviceActivityMonitor class I am not able to restrict the apps / categories. It's as if MyModel does not have any values set from within MyMonitor. I have confirmed that MyModel does have the correct FamilyActivitySelection apps. – sam Dec 16 '22 at 13:12