Posts

Post not yet marked as solved
3 Replies
893 Views
A type of question I see often is "which UI framework is best? SwitUI, UIKit, AppKit, etc?" And the answer is, of course, usually "it depends" or "a mix, depending on what you need". I wanted to re-frame that question with specific parameters. Let's say you were writing Apple Photos for the Mac from the ground up, starting today. For the sake of discussion, it's going to be functionally identical to the Photos app that exists on the Mac today. Which means it: looks and feels like a true, native macOS app should be very performant in terms of rendering and scrolling through a library that may contain hundreds of thousands of photos maintains a large database which can be synced over iCloud etc When you go to write that first line of UI code, which UI framework are you reaching for, and why? If more than one, which ones would you use for each piece, and why? Especially interested to hear any viewpoints from Apple folks in this thought exercise!
Posted
by stevenf.
Last updated
.
Post not yet marked as solved
7 Replies
7.4k Views
Hello, I'm trying to mock up a simple UI for a typical Mac app with a sidebar and a content area.Starting from the SwiftUI Xcode template, I got this far:struct ContentView : View { var body: some View { HSplitView() { List() { Text("Sidebar") Text("Sidebar") Text("Sidebar") Text("Sidebar") } List() { Text("Content") Text("Content") Text("Content") Text("Content") } } .frame(minWidth: 100, maxWidth: .infinity, minHeight: 100, maxHeight: .infinity, alignment: .topLeading) } }Two big issues so far:1. The top-level HSplitView does not resize with the window. It remains at the size it is created when the app launches, regardless of how you resize the window. Does the NSHostingView need to have an autoresizing mask or layout constraints? (It doesn't come with any in the Xcode template.)2. I can't seem to make the two subviews of the splitView resizable by the splitter, even if I give them frame() modifiers.Since this API is so new, I can't find any examples online.Has anyone successfully made a macOS app in SwiftUI that has typical sidebar/content splitView that resizes with the window, and whose subviews can be resized by dragging the spliiter?Thanks!
Posted
by stevenf.
Last updated
.