I'm currently working on a SwiftUI subscription manager app and getting ready to launch my first TestFlight beta soon. Things are going well so far, the only thing I'm having trouble figuring out is how to schedule notifications based on a subscription start date, as well as calculating the next renewal date.
Upon adding a subscription, the user will be able to specify a start date, whether it renews weekly, monthly or annually as well as when the notification should be sent. The user can choose between being notified on day of renewal to 7 days before renewal.
I also need a way to calculate the date of next renewal. The next renewal date will not be stored, only the start date. I've been thinking to solve this by getting the next trigger date of the notification, as well as accounting for how many days before renewal.
It would be really appreciated if someone knows the solution to this problem.