Post

Replies

Boosts

Views

Activity

Is SwiftUI Picker not compatible with a Bindable property?
I have a view with @Bindable property. (It's a model) I can use TextField("Name", text: $chore.name), but not Picker(selection: $chore.choreFrequency, label: EmptyView()) The auto-complete doesn't even show choreFrequency as an option enum ChoreFrequency: String, CaseIterable, Identifiable, Codable { case daily, weekly, monthly, seasonal var id: ChoreFrequency { self } } @Model class Chore: Identifiable { @Attribute(.unique) var id = UUID() var name: String var frequency: ChoreFrequency var assignedTo: FamilyMember var isComplete: Bool var dueDate: Date } Can I not use the Bindable property in the Picker?
3
0
1.4k
Sep ’23
Is SwiftUI Picker not compatible with a Bindable property?
I have a view with @Bindable property. (It's a model) I can use TextField("Name", text: $chore.name), but not Picker(selection: $chore.choreFrequency, label: EmptyView()) The auto-complete doesn't even show choreFrequency as an option enum ChoreFrequency: String, CaseIterable, Identifiable, Codable { case daily, weekly, monthly, seasonal var id: ChoreFrequency { self } } @Model class Chore: Identifiable { @Attribute(.unique) var id = UUID() var name: String var frequency: ChoreFrequency var assignedTo: FamilyMember var isComplete: Bool var dueDate: Date } Can I not use the Bindable property in the Picker?
Replies
3
Boosts
0
Views
1.4k
Activity
Sep ’23
How to override [CodingKey] to an Encoder or Decoder?
The Encoder and Decoder protocols have this property: var codingPath: [CodingKey] { get } In my own custom coding class, how do I override this and pass valid CodingKeys? Every document and code example uses the enum to define coding keys. Thanks.
Replies
1
Boosts
0
Views
533
Activity
Oct ’23
Xcode 16 preview not working
I want to add SwiftUI to an existing package. Super simple to get started. It previews with Xcode 15.4, but gives an error on Xcode 16.0: JITError: Runtime linking failure Anyone have an idea on what may be failing? Full SwiftUI code: import SwiftUI struct Dashboard: View { var body: some View { Text("hello") } } #Preview { Dashboard() }
Replies
4
Boosts
3
Views
4k
Activity
Sep ’24
Cannot Preview SwiftUI - dependent package
I have a normal UIKit project with a package dependency containing some SwiftUI. Opening the package on its own, I can preview the SwiftUI. However, when I have the package as a dependency, I get the dreaded message saying Active scheme does not build this file regardless of choosing the app or package scheme. Why can't I get a preview? Using Xcode 16
Replies
0
Boosts
0
Views
417
Activity
Sep ’24
SwiftUI image from Bundle.main not working
I have a project with a single asset image. In the dependency package, I am attempting to preview using the image in the project using Bundle.main. I just get a blank. How can I get this to work? Sample project here: https://github.com/AaronBratcher/SwiftUIPreviewProblem
Replies
6
Boosts
1
Views
1.3k
Activity
Oct ’24