Post

Replies

Boosts

Views

Activity

SwiftData Class Inheritance
Hi, I'm considering using the new SwiftData class inheritance for a new app I'm building. I have a few questions: Is it working well enough for production? I have a number of different object types in my app. Some of them are very similar, and there's always a balance to be struck when it comes to splitting them into different types using class inheritance. Are there some good advice on when to use multiple classes instead of squeezing my object types into a single class? Is there advice against using class inheritance in multiple levels (3-4)? Claes
1
0
107
Jul ’25
Family Sharing needed on iOS16?
After watching the video "What's new in Screen API", I was convinced that the Screen Time API now opens up for a broader range of apps without the need to involve Family Sharing. Like the example app "Workload" they are using in the video, an app for an individual not involving Family Sharing at all (?) I have now built an app of a similar type, but Apple denied me the Family Controls entitlement "...as your app doesn’t utilize Family Sharing, which is required for Family Controls." I am confused here. Does anyone have more information and/or can explain to me? My, perhaps optimistic, view is that the entitlement request reviewer based their decision on iOS 15 rules rather than the additions made to iOS 16. And input and advice is much appreciated :-)
3
0
1.1k
Oct ’22
DeviceActivity setup
Hi! I'm playing around with the Screen Time API. I would like to let my app notify me every time I have used my device for 1 minute (any app). When I have been notified, I would like to reset the monitoring so that I will be notified again after another minute using my device. I'm not sure how to accomplish this. In the main app, I currently start monitoring the following event with a schedule: let event = DeviceActivityEvent(threshold: DateComponents(minute: 1)) let schedule = DeviceActivitySchedule(intervalStart: DateComponents(hour: 0, minute: 0, second: 1), intervalEnd: DateComponents(hour:23, minute: 59, second: 59), repeats: true) Then, in the Device Activity Monitor Extension, I restart the same monitoring once the threshold is reached in eventDidReachThreshold. However, eventDidReachThreshold is being called much more than once an hour. I have checked that I only have one monitoring event running, so duplicates does not seem to be a problem. So, my questions are: Does my approach look OK? What am I missing? Would this monitoring collect usage from all devices connected to the same Apple ID, i.e. my Mac, iPad, iPhones etc? If so, how can I make it only monitor usage on one of my devices (the iPhone running the app)?
2
0
1.2k
Jun ’22