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?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
When using a UIHostingController to host my SwiftUI content, I can't get the navigation title to start large and shift to inline as the user scrolls. Is this a known problem with using the UIHostingController?
var viewModel: DashboardViewModel!
lazy var contentView = UIHostingController(rootView: DashboardView(viewModel: viewModel))
override func viewDidLoad() {
super.viewDidLoad()
addChild(contentView)
view.addSubview(contentView.view)
setupConstraints()
navigationItem.title = "Test Title"
navigationItem.largeTitleDisplayMode = .automatic
}
The title in the navigation controller shows inline
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()
}
When showing an ImageDownloader actor, the presenter said a solution on avoiding duplicate downloads is shown with the code associated with this video. When will this code be available? I don't see it on the video page.
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