Post

Replies

Boosts

Views

Activity

dual predicate search using CoreData
I have a very simple CoreData model that has 1 entity and 2 attributes. This code works fine: .onChange(of: searchText) { _, text in evnts.nsPredicate = text.isEmpty ? nil :NSPredicate(format: "eventName CONTAINS %@ " , text ) but I'd like to also search with the same text string for my second attribute (which is a Date). I believe an OR is appropriate for two conditions (find either one). See attempted code below: evnts.nsPredicate = text.isEmpty ? nil : NSPredicate(format: "(eventName CONTAINS %@) OR (dueDate CONTAINS %i) " , text ) This crashes immediately %@ does the same. Is there a way to accomplish this? How is SwiftUI not an option below?
6
0
285
Mar ’25
Let's talk about SwiftUI DefaultDatePickers
Is there a way to add the day of the week to the wheel picker that pops up inside the Default calendar picker? How about an optional way to type a date in instead of lots of scrolling? DatePicker("Enter a date", selection: $date1, displayedComponents: .date) .datePickerStyle(DefaultDatePickerStyle()) This works OK, but it seems slow when entering a date to need to scroll and then tap the calendar again to fix the day of the week. Maybe a custom entering screen is the best path? It's frustrating that SwiftUI doesn't offer more options. I see that Contacts goes right to the Wheel style, but Calendar uses this pop up calendar (Default) style) Maybe someone thinks that 3 scroll wheels are too much?
Topic: UI Frameworks SubTopic: SwiftUI
0
0
337
Jun ’24
landscape support
I heard someone say recently that not supporting landscape on iPhone could be an accessibility problem for some folks. Right now I've got an SwiftUI app were lots of things break when I go to landscape mode. Is there a good resource to learn how to animate layouts around to support landscape when there's no way it will fit with the default twist?
Topic: Design SubTopic: General Tags:
1
1
598
Jun ’24