Post

Replies

Boosts

Views

Activity

SwiftUI preview for drag/drop APIs
The new drag & drop APIs for macOS 26 are terrific, but there's an important missing piece. If I use draggable(containerItemID:), there's no way to provide a custom view for the drag image. Meanwhile the older API lets you provide a preview, but you miss out on things like multi-item drag and custom drag sessions. Is there some mechanism for supplying a preview that I'm not seeing? Without it, the drag interface in my apps is going to look terrible.
0
0
68
1w
Modularizing an Xcode 16 project
My preferred way of setting up an app project no longer works in Xcode 16. I like to have my apps massively modularized - a separate SPM module for every significant feature. I use a project grouped together with a package that contains all the feature modules. The project's app target imports a consolidated AppFeature from the package that is all the logic of the app. In Xcode 15 and before, I had a process for creating this kind of setup (described below -- unfortunately the forums don't support collapsible sections). Where I used to be able to drag a directory from Finder into the Xcode files navigator (step 6 in my process), it now rejects the drag. What I'm looking for is a way to have a single window open that has my Swift package and below that a separate folder for each executable target. Creating new modules in the package automatically creates new schemes in Xcode. Executable targets in the project can reference any module in the package. Source control treats the entire thing as one repository. I've tried all the approaches I can think of to accomplish the same goal, but no luck. The projects I've already built work fine in Xcode 16 -- I just can't make a new one. Unfortunately I can't revert to Xcode 15 for this purpose since it apparently doesn't run on my work machine with macOS 15. Here's my process that worked great till now: In Terminal, create the project folder Foo: $ mkdir Foo $ cd Foo Create the package: $ swift package init Creating library package: Foo Creating Package.swift ... Create a directory for the project: $ mkdir App In Xcode, create a new app project called Foo and put it in the App folder Open the Foo project Drag the top level Foo directory from Finder into the Xcode project and drop it immediately under the project name Close the Xcode project Create a file called Package.swift and place it in the App folder. Edit it to have an empty package content. This ensures Xcode won’t display that folder in the source navigator under the package header. import PackageDescription let package = Package( name: "", products: [], dependencies: [], targets: [] ) Open the Xcode project. You should have top-level project name* Foo*. Under that will be the package, also named Foo. Then there will be the app target, also named Foo. You can rename the app target folder Foo to something like iOS if you want to have other targets for other platforms like macOS.
1
0
1k
Dec ’24
Big Sur toolbar item in the sidebar
In "Adopt the new look of macOS", it mentions the ability to place a toolbar item in the sidebar, but I haven't been able to achieve this. I have a three-pane split view with the left split view item having the sidebar behavior. The window controller acts as the toolbar delegate, passing three items as default identifiers: [.toggleSidebar, .sidebarTrackingSeparatorItemIdentifier, .rightSeparator] where rightSeparator generates an NSTrackingSeparatorToolbarItem between the right-most two panes. Since .toggleSidebar comes before the separator, I understood that it should be placed over the sidebar when expanded. However, it stays to the right of the separator. Is there some other configuration I'm missing to achieve this?
Topic: Design SubTopic: General Tags:
2
0
1.1k
Jul ’20
Full-height split view on macOS
I have a window with a 3-pane split view. I'd like the layout to emulate Mail on macOS 11 where all three panes are full height. As indicated in "Adopt the New Look of macOS" I have the fullSizeContentView style mask set and the left NSSplitViewItem has its behavior set to sidebar. This gives a full height left sidebar. How can I achieve a full height split between the center and right panes of the split view? I tried applying the sidebar behavior to the rightmost NSSplitViewItem which gives it the transparent background, but it doesn't extend the split to the top of the window. I also tried this with and without a toolbar to see if this made a difference--it didn't. Any ideas? 🤔
2
0
1.8k
Jul ’20