Post

Replies

Boosts

Views

Activity

Reply to can't use @Environment for Binding?
This code has good performance. But it is not cleaner than @EnvironmentObject struct View2: View { @Environment(View1Model.self) var viewModel var body: some View { TextField("Text", text: Binding(get: { viewModel.text }, set: { newValue in viewModel.text = newValue })) } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’23
Reply to can't use @Environment for Binding?
struct TitleEditView: View { @Environment(Book.self) private var book var body: some View { @Bindable var book = book TextField("Title", text: $book.title) } } I found this from Bindable Document https://developer.apple.com/documentation/swiftui/bindable thanks @macrojd
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’23
Reply to can't use @Environment for Binding?
This code has good performance. But it is not cleaner than @EnvironmentObject struct View2: View { @Environment(View1Model.self) var viewModel var body: some View { TextField("Text", text: Binding(get: { viewModel.text }, set: { newValue in viewModel.text = newValue })) } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’23
Reply to How do I access the WidgetLocation property in iOS 17?
https://developer.apple.com/documentation/swiftui/widgetconfiguration/disfavoredlocations(_:for:)?changes=latest_major&language=objc
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Aug ’23
Reply to can't use @Environment for Binding?
struct TitleEditView: View { @Environment(Book.self) private var book var body: some View { @Bindable var book = book TextField("Title", text: $book.title) } } I found this from Bindable Document https://developer.apple.com/documentation/swiftui/bindable thanks @macrojd
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’23
Reply to Why AppIntentConfiguration(iOS 17) is covered with gray(redacted)?
Problem Resolved! Cause WidgetConfigurationIntent in other SwiftPackage is not loaded correctly How to Fix Move to Main(Widget) Target
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Aug ’23