Post

Replies

Boosts

Views

Activity

Reply to One to Many Relationship in SwiftData
I tried the code below, with SiftData models also below, but I got the error .. Value of type Sight has no member destination ! ForEach (destination.sights) { sight in VStack { Text(sight.name) Text(sight.destination.name) } } @Model class Destination { var name: String var details: String var date: Date var priority: Int @Relationship(deleteRule: .cascade) var sights = [Sight]() init(name: String = "", details: String = "", date: Date = .now, priority: Int = 2) { self.name = name self.details = details self.date = date self.priority = priority } } @Model class Sight { var name: String init(name: String) { self.name = name } }
Sep ’24
Reply to Text Don't Show in swipeActions buttons !
Thanks, it's working now, one last question is it possible to use views such as in code below ? maybe for example I want to show to circle buttons ? I remember Apple Mail used this design before ? Kind Regards Button(role: .destructive) { withAnimation { deletePatient2() } } label: { View1() } Button { deletePatient2() } label: { View2() } .tint(.orange) }
Jul ’24
Reply to Hiding chevron from list, SwiftUI
ForEach (patients) { patient in NavigationLink (value: patient) { PatientRow(patient: patient) } } .onDelete(perform: deletePatient) .listRowSeparator(.hidden) } .listStyle(.plain) .buttonStyle(PlainButtonStyle()) .scrollIndicators(.hidden) .navigationDestination(for: Patient.self) { patient in PatientDetails(patient: patient) }
Topic: UI Frameworks SubTopic: SwiftUI
Jun ’24