Posts

Post not yet marked as solved
1 Replies
395 Views
I'm working on adding support in my app for full-height sidebars, as introduced in macOS 11. The trick is, when the window tab bar is visible, I want to turn the full-height sidebar off. The two don't mix well when the sidebar content is different in each window, as it is in my app. See Xcode for an example of what I want to do (View Show Window Tab Bar). See Preview for an example of what I want to avoid (open two multi-page PDFs and put them in a single tabbed window). What's working: I observe the window's tabbedWindows property, and toggle the fullSizeContentView flag in its styleMask accordingly. Thus the window's style updates as needed when I hide and show the tab bar. What's not working: I need to have a sidebarTrackingSeparator item in my toolbar in order to have some items above the sidebar. But when fullSizeContentView is off, that item appears as a plain separator. I don't want it to be visible at all in that state. There isn't a straightforward way to hide a toolbar item, especially if it doesn't have a view, which it turns out this one doesn't. I tried removing the separator item and re-adding it when the window state toggles, but that leads to Cocoa throwing exceptions, complaining that only one tracking item can be registered at a time. This would seem to be a bug, but Xcode manages it somehow. So how can I properly toggle my window and toolbar state without having that visible separator?
Posted
by Uncommon.
Last updated
.
Post not yet marked as solved
0 Replies
937 Views
In AppKit, there is NSHostingController and NSHostingView. In UIKit, there is only UIHostingController. So what gives? Sure, you can use UIHostingController, grab its view, and ignore the controller (ie not bother adding it as a child view controller). But it seems reasonable to assume that the omission of UIHostingView is intentional and you need the view controller properly connected to make things work right. But which things? The problem is that incorporating UIHostingController into a view controller hierarchy can be difficult because you might not know at that point it the code what the parent view controller is (unless you add some otherwise unnecessary contortions). And yet the docs say you're supposed to add the child view controller to its parent before you add the view to the superview. For example, you could have a situation where your UIView is sandwiched in the hierarchy in between SwiftUI components - both embedding and embedded in SwiftUI. In my experiments this works fine in may ways, but UIViewRepresentable doesn't give you a view controller to be the parent of your UIHostingController. So you're stuck with the consequences of an orphan view controller... whatever they are.
Posted
by Uncommon.
Last updated
.
Post marked as solved
3 Replies
833 Views
Is there a way to turn off the sandbox for my UI test target?My app works with git repositories, so in my tests I want to call out to command-line git to verify the results. But when I try, I get an error that git can't be run from within an app sandbox. Since I never explicitly enabled sandboxing for the app or the tests, I'm having trouble finding how to turn it off. Is it possible? Or will I have to copy git into the test bundle so I can run it from there?
Posted
by Uncommon.
Last updated
.