Post

Replies

Boosts

Views

Activity

Reply to macOS SwiftUI Table with contextMenu
Here's how to ensure that the hitbox for the context menu extends across the entire cell for all cells in the table view: Text("Item at \($0.name!)")   .frame(     maxWidth: .infinity,     maxHeight: .infinity,     alignment: .leading   )   .contentShape(Rectangle())   .contextMenu {     Button(action: {}) { Text("Action 1") }     Divider()     Button(action: {}) { Text("Action 2") }     Button(action: {}) { Text("Action 3") }   }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’22
Reply to How to implement the right detail panel by swiftUI?
NavigationView {   Text("sidebar")   HSplitView {     Text("Primary View")       .frame(maxWidth: .infinity, maxHeight: .infinity)       .background(.blue)       .layoutPriority(1)     Text("Detail Panel")       .frame(maxWidth: .infinity, maxHeight: .infinity)       .background(.red)   } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’22
Reply to How to implement the right detail panel by swiftUI?
Try this: NavigationView {   Text("sidebar")   HSplitView {     Text("Primary View")       .frame(maxWidth: .infinity, maxHeight: .infinity)       .background(.blue)     Text("Detail Panel")       .frame(maxWidth: .infinity, maxHeight: .infinity)       .background(.red)   } } The background colors aren't even necessary. They just allow you to better visualize the bounds of each section of the HSplitView.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’22
Reply to How to create proper array time at runtime in Swift
If you don't know the types of the array's elements in the "channel" at compile-time, then I would recommend that you convert them to the widest number type among all of the possible types in the channel. For example, if the channel could contain Int32 or Int64 number types, then your array in Swift should always contain elements of type Int64, because this is the wider type. Just convert values of type Int32 to Int64 when initializing the Swift array from the channel data.
Topic: Programming Languages SubTopic: Swift Tags:
Feb ’22
Reply to macOS SwiftUI Table with contextMenu
Here's how to ensure that the hitbox for the context menu extends across the entire cell for all cells in the table view: Text("Item at \($0.name!)")   .frame(     maxWidth: .infinity,     maxHeight: .infinity,     alignment: .leading   )   .contentShape(Rectangle())   .contextMenu {     Button(action: {}) { Text("Action 1") }     Divider()     Button(action: {}) { Text("Action 2") }     Button(action: {}) { Text("Action 3") }   }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to How to define a generic SwiftUI view that can accept sectioned fetch results for different entities
What are the similarities between Patient and Doctor that lead you to believe you should be using generics? What should the content of GenericView be if the fetch results are Patient vs Doctor? You should start by creating two separate concrete implementations of GenericView for each type of fetch result.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to How to implement the right detail panel by swiftUI?
NavigationView {   Text("sidebar")   HSplitView {     Text("Primary View")       .frame(maxWidth: .infinity, maxHeight: .infinity)       .background(.blue)       .layoutPriority(1)     Text("Detail Panel")       .frame(maxWidth: .infinity, maxHeight: .infinity)       .background(.red)   } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to How to implement the right detail panel by swiftUI?
Try this: NavigationView {   Text("sidebar")   HSplitView {     Text("Primary View")       .frame(maxWidth: .infinity, maxHeight: .infinity)       .background(.blue)     Text("Detail Panel")       .frame(maxWidth: .infinity, maxHeight: .infinity)       .background(.red)   } } The background colors aren't even necessary. They just allow you to better visualize the bounds of each section of the HSplitView.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to How to create proper array time at runtime in Swift
If you don't know the types of the array's elements in the "channel" at compile-time, then I would recommend that you convert them to the widest number type among all of the possible types in the channel. For example, if the channel could contain Int32 or Int64 number types, then your array in Swift should always contain elements of type Int64, because this is the wider type. Just convert values of type Int32 to Int64 when initializing the Swift array from the channel data.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Feb ’22