Join Nostr
2025-10-08 17:57:47 UTC

npub1nj…52gqz on Nostr: I have worked on implementing tabs and I think I'm quite happy with the result so ...

I have worked on implementing tabs and I think I'm quite happy with the result so far. I have mostly been spending my time getting the UI to look good with some animations _(the animations could use some more work though)_.

It's possible to rearrange tabs by dragging a tab left and right. Simple stuff like closing a tab also works. I do need to get the shortcut `CMD + W` to work as well, so it's faster to close tabs. The home-tab cannot be closed, so when the user selects the home-tab (or there is no other tabs except home-tab) and clicks the close-shortcut, it will not close the tab, but instead close the window.

**Problem:** It's only possible to drag tabs in the horizontal direction (x-axis). This means, tabs can only be dragged inside the tab-area. But ideally, it should be possible to drag tabs outside the tab-area. When doing so and releasing the tab, it should open the tab in a new window.

I'm struggling a bit to get this behavior working. Funny enough, it works fine except when using a ScrollView, because then the tab will clip to the ScrollView. This means the tab will just be hidden in the UI when trying to drag it outside the ScrollView...

I am switching between a normal HStack and a ScrollView depending on the amount of tabs. If there are too many tabs to show in the viewport, the app will switch over to using a ScrollView, and this is where the problem begins, because it hides the tab when trying to drag outside. Also, the switching between HStack and ScrollView can cause some glitches. #dev #SwiftUI #AppKit