I have an iPhone 11 Pro Max running iOS 26. But since iOS 18, Apple decided to remove the "Time in Bed" feature[1][2].
Is it possible to develop an app that, effectively, "brings back" this feature? It doesn't have to be that accurate. Just a gauge is fine.
As a starter I would like to track the time the phone was in Sleep mode (regardless whether the phone is being used).
I have a minimal programming background but have not developed an iOS app before so any help would be appreciated.
I found out about HealthKit[3] which lets me access (edit?) Health data, but I don't know where to go from there.
[1] https://www.reddit.com/r/iOSBeta/comments/1em8bl6/ios_181_db1_time_in_bed_via_iphone_feature_removed
[2] https://www.reddit.com/r/ios/comments/1fkjat4/apple_removed_the_iphoneonly_sleep_tracking