ios – Replace variables when day adjustments Swift

I believe I’ll have a bug in my iOS app
I am presently constructing a category that’ll permit me to fetch knowledge from consumer’s calendar, however I noticed I might need a bug if the consumer leaves the app with out closing it, after which comes again after making adjustments in his calendar occasions, my app will not take them into consideration.

For now I am on the very starting of the category (nonetheless comparatively new in OOP) however I believe I am going to encounter the identical drawback with solely this little bit of code (if he leaves the app at 11:45pm after which comes again at 1:00am the day is not going to be up to date I suppose ?)

So I am searching for an answer to this, thanks quite a bit if somebody can assist (excuse my English I am French =D)

This is the category

/// This class will include all of the strategies used to fetch knowledge (subsequent occasion, final occasion of day and so on) from consumer's calendar
class CalendarManager {
    public var weekdayNb: Int
    public var weekday: String
    public var day: String
    public var monthNb: Int
    public var month: String
    public var yr: String
    personal let weekDays = [
    personal let months = [
    init() {
        let date = Date()
        self.weekdayNb = Calendar.present.element(.weekday, from: date) - 1
        self.weekday = weekDays[weekdayNb] = String(Calendar.present.element(.day, from: date))
        self.monthNb = Calendar.present.element(.month, from: date)
        self.month = months[monthNb - 1]
        self.yr = String(Calendar.present.element(.yr, from: date))

Similar Posts

Leave a Reply

Your email address will not be published.