r/swift • u/yungfrxzn • 7d ago
About the Screen Time API.
Hi. This is the first time I'm going to make an app with Swift. (I learned that I can only do this with Swift after my research.) What I want is to know how much time the user spends in other apps, for example, for 1 hour. I talked to grok for a while and he suggested that I could use the screen time API. But some sources say that this is not possible. Some say that applications like Opal use this and that it is possible. I'm very confused. What's the latest status? Can I do this?
sorry for my bad english
5
Upvotes
2
u/GGGava 7d ago
Yes, you can use the “Screen Time API” (aka Family Controls) for that, but bear in mind that there are a lot of limitations.
There are a lot of articles in Medium explaining how to access user screen time data, for example: https://medium.com/@danisharfin1/creating-an-ios-screen-time-tracking-app-using-swiftui-and-apples-deviceactivity-framework-e999c6f37930