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 Core Spotlight on macOS: Is thumbnailData used?
I'm also seeing the same behavior on macOS 12.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Oct ’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 SwiftUI Toggle multiple times per frame
Have you tried wrapping request(action: .PSU, param: psu.name) in DispatchQueue.main.async in order to perform it on the next run loop?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to So... AnimatableModifier is now deprecated, but how to "use Animatable directly"?
Conform your view modifier to ViewModifier and Animatable explicitly.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to Why Pie Chart View redraw lag after I switch schemes .system, .light & .dark mode?
It's impossible for anyone to answer your question if you don't include a reference to the source code of this app.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to SwiftUI: View state haven't been changed but still get updated
"As I know View in SwiftUI will get updated only if @Binding or @State values haven been modified." There are many more reasons why the View will be re-computed.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to How create Log Events with Swift?
Also, this does not belong in the SwiftUI category.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to How create Log Events with Swift?
If you're referring to the Console macOS app, then you should use the Logging framework.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to How to sort SwiftUI Table with Data from Core Data FetchResult
Read the Supporting Sorting in Tables section of the documentation again. It recommends that you add an onChange modifier and perform the sorting there: .onChange(of: sortOrder) { sortOrder in clubs.sort(using: sortOrder) }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’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
Reply to How to prevent UITextField from intepreting its characters (e.g. converting "..." to elipsis)
What do you want to happen when the text cannot fit within the bounds of the UITextField?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Feb ’22