Post

Replies

Boosts

Views

Activity

Button Style Glass Prominent Ignored on Menu When Used Inside ToolbarItem
When a Menu is placed inside a ToolbarItem, applying buttonStyle(.glassProminent) has no visible effect. The same modifier works correctly when a Button is used instead of a Menu inside the ToolbarItem. In that case, the button is rendered with the accent-colored background as expected. This suggests that Menu does not respect the .glassProminent button style when embedded in a ToolbarItem, even though other button types do. Code Example // Button with accent background color .toolbar { ToolbarItem(placement: .primaryAction) { Button(action: {}) .buttonStyle(.glassProminent) } } // Menu with internal button with no accent background color .toolbar { ToolbarItem(placement: .primaryAction) { Menu(...) { ... }.buttonStyle(.glassProminent) } }
Topic: UI Frameworks SubTopic: SwiftUI
1
0
53
1w
Naming Collision Between Model Attribute and Enum Case in SwiftData and CloudKit
There is a conflict in SwiftData (specifically when synced with CloudKit) when a @Model attribute shares the same name as a case within its assigned enum type. When this occurs, accessing the attribute on a model instance consistently returns the value corresponding to the enum case name, rather than the actual value persisted in the database. Steps to Reproduce Define an enumeration (e.g., Status) with a case that matches a planned property name (e.g., case status). Create a SwiftData @Model that uses this enum. Name the property in the model the same as the enum case. Attempt to save and then retrieve the value. Example Code enum TaskStatus: String, Codable { case status // The conflict source case pending case completed } @Model class TodoItem { // Conflict: Property name matches enum case name var status: TaskStatus init(status: TaskStatus) { self.status = status } } Expected Behavior The property item.status should return the value stored in the database (e.g., .pending or .completed). Actual Behavior The property item.status consistently resolves to the enum case .status, ignoring the actual persisted data.
1
0
54
1w