HomeiOS Developmentios - View Flickering When Selecting the Picker Choice

ios – View Flickering When Selecting the Picker Choice


When altering the picker from “None” to some other, it glints to the left of the display and solely then goes away. When altering the opposite properties, it’s working advantageous.

That is the picker with Alert Choices (I do not suppose there’s something flawed right here, however in any case):

HStack {
                                Textual content("Alert")
                                    .font(.title3.daring())
                                Spacer()
                                Picker("Alert", choice:
                                        detailType == .occasion
                                       ?
                                        $calendarViewModel.selectedEvent.alert
                                       :
                                        $remindersViewModel.selectedReminder.alert
                                ) {
                                    ForEach(Occasion.Alerts.allCases, id: .self) { alert in
                                        Textual content(alert.rawValue)
                                    }
                                }
                            }
                            .onChange(of:
                                        detailType == .occasion
                                      ?
                                       calendarViewModel.selectedEvent.alert
                                      :
                                       remindersViewModel.selectedReminder.alert
                            ) { alert in
                                remindersViewModel.heart.getNotificationSettings { settings in
                                    if settings.authorizationStatus != .licensed && alert != .noAlerts {
                                        remindersViewModel.heart.requestAuthorization(choices: [.alert, .badge, .sound]) { success, error in
                                            if !success {
                                                Activity { @MainActor in
                                                    swap detailType {
                                                    case .reminder:
                                                        remindersViewModel.showingAlertErrorAlert = true
                                                    case .occasion:
                                                        calendarViewModel.showingAlertErrorAlert = true
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }

I believe “flickering” of the picker is linked to this phase of code displaying solely when the picker possibility will not be “None”:

// MARK: - Optionally available Alert Misc Information
                        Group {
                            HStack {
                                Textual content("Further Alert Settings")
                                
                                Picture(systemName: "chevron.proper")
                                    .rotationEffect(alertSettingsTapped ? .levels(90) : .levels(0))
                            }
                            .font(.system(dimension: 15, weight: .daring))
                            .onTapGesture {
                                alertSettingsTapped.toggle()
                            }
                            .padding(.vertical)
                            
                            // MARK: - Listing of extra alert settings
                            ZStack {
                            }
                            .tint(.black)
                            .opacity(alertSettingsTapped ? 1 : 0)
                            
                        }
                        .animation(.default, worth: alertSettingsTapped)
                        .opacity(correctAlertType != .noAlerts ? 1 : 0)
                        .animation(.default, worth: correctAlertType)

Right here can be small video with the issue I’m dealing with:
problem

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments