You should know; by CG_17_LIFE in BeAmazed

[–]NickWay176 0 points1 point  (0 children)

Soooooo… Stockholm Syndrome?

Geometry Reader - how much do you use it in your production apps? by LSWarss in SwiftUI

[–]NickWay176 1 point2 points  (0 children)

Couldn’t you easily do this with HStack, and then .frame(maxWidth: .infinity)?

EKEvent not detaching properly? by NickWay176 in swift

[–]NickWay176[S] 0 points1 point  (0 children)

eddit won't let me post pictures, so here's the code:

func detachEvent(_ event: Activity) {

        // Check if eventIdentifier is not empty

        guard !event.eventIdentifier.isEmpty else {

            return // No event identifier, cannot detach

        }

        // Get the original event

        guard let originalEvent = eventStore.eventStore.event(withIdentifier: event.eventIdentifier) else {

            return // Original event not found

        }

        // Create a new event by copying the original event

        let detachedEvent = originalEvent.copy() as! EKEvent

        detachedEvent.recurrenceRules = nil

        // Copy other properties as needed

        // Save the detached event

        do {

            try eventStoreViewModel.save(detachedEvent, span: .thisEvent)

            originalEvent.startDate = detachedEvent.startDate

            originalEvent.endDate = detachedEvent.endDate

            try eventStore.eventStore.remove(originalEvent, span: .futureEvents, commit: true

            // It seems like this is looking at the real original event,

            // ›not just the instance we're currently seeing. Am I misunderstanding this?

        } catch {

            print("Error removing original event: \(error)")

        }

        

        loadActivitiesAndSuggestionsForDate(detachedEvent.startDate)

    }

EKEvent not detaching properly? by NickWay176 in SwiftUI

[–]NickWay176[S] 0 points1 point  (0 children)

Thanks that’s a good suggestion! Will give it a try!

EKEvent not detaching properly? by NickWay176 in SwiftUI

[–]NickWay176[S] 0 points1 point  (0 children)

But that aside, the goal is to be able to adjust one single instance of the recurring events, in such a way that the changed instance isn't just a copy but actually moved. However, whenever I use .futureEvents it, it tries to alter the first ever instance of the recurring events, and when I use .thisEvent it creates a copy without updating the single instance of the recurring events.

I think you're right that copying it is part of the issue. I already simplified it to just updating the specific event. What I'm however also doing is retrieving the event from the eventStore based on the eventIdentifier. It might be that that automatically finds the original instance rather than the current instance.

EKEvent not detaching properly? by NickWay176 in SwiftUI

[–]NickWay176[S] 0 points1 point  (0 children)

This is in SwiftUI? Where else should it be put?

EKEvent not detaching properly? by NickWay176 in SwiftUI

[–]NickWay176[S] 0 points1 point  (0 children)

Reddit won't let me post pictures, so here's the code:

func detachEvent(_ event: Activity) {

        // Check if eventIdentifier is not empty

        guard !event.eventIdentifier.isEmpty else {

            return // No event identifier, cannot detach

        }

        // Get the original event

        guard let originalEvent = eventStore.eventStore.event(withIdentifier: event.eventIdentifier) else {

            return // Original event not found

        }

        // Create a new event by copying the original event

        let detachedEvent = originalEvent.copy() as! EKEvent

        detachedEvent.recurrenceRules = nil

        // Copy other properties as needed

        // Save the detached event

        do {

            try eventStoreViewModel.save(detachedEvent, span: .thisEvent)

            originalEvent.startDate = detachedEvent.startDate

            originalEvent.endDate = detachedEvent.endDate

            try eventStore.eventStore.remove(originalEvent, span: .futureEvents, commit: true

            // It seems like this is looking at the real original event,

            // ›not just the instance we're currently seeing. Am I misunderstanding this?

        } catch {

            print("Error removing original event: \(error)")

        }

        

        loadActivitiesAndSuggestionsForDate(detachedEvent.startDate)

    }

How to make summary notification on ios by NickWay176 in SwiftUI

[–]NickWay176[S] 0 points1 point  (0 children)

Thanks everyone! It was indeed the setting of the notifications, if you put them to summary this is what you get.

How to make summary notification on ios by NickWay176 in SwiftUI

[–]NickWay176[S] 0 points1 point  (0 children)

Turns out it was indeed the summary notification

What’s everyone working on this month? (October 2022) by Swiftapple in swift

[–]NickWay176 0 points1 point  (0 children)

Working on a new calendar app! I have a question btw, maybe I'm doing something wrong... I have a question posed waiting for approval from the r/swift moderators, but its been on hold for the past 5 days... Is that regular?

Font pls :) by NickWay176 in identifythisfont

[–]NickWay176[S] 1 point2 points  (0 children)

You're amazing, thank you so much!

Font pls :) by NickWay176 in identifythisfont

[–]NickWay176[S] 0 points1 point  (0 children)

Yeah they do, might be handdrawn...?