shakedown.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A community for live music fans with roots in the jam scene. Shakedown Social is run by a team of volunteers (led by @clifff and @sethadam1) and funded by donations.

Administered by:

Server stats:

268
active users

#swiftuwhy

0 posts0 participants0 posts today

This is why I think layout is by far the biggest problem of #SwiftUI. Why is the second column of the grid changing width because of what is in the first!?

Multi-line labels on macOS SwiftUI always seem to layout in a completely arbitrary way.

And that Color.clear.gridCellUnsizedAxes thing is the recommended way, per the documentation, of creating an empty cell (which is in itself questionable, it seems there should be a GridEmptyCell() view that does the right thing). #SwiftUWhy #macdev

Xcode should track the lifetime number of hours spent trying to find the error in your SwiftUI view code that is causing the “compiler is unable to type-check this expression in reasonable time” message to appear after the obligatory a 60-second wait. #SwiftUWhy

Why can’t I find a simple way to do this?

.textSelection(allowSelection ? .enabled : .disabled)

This code does not compile because the types don't match. Fine. But there should be a simple way to do this.

(This is why I never delete the dreaded .if(…) view modifier from my projects…)

Replied in thread

Agh!!!!
Turmoil to get there:
3. This broke the debug-only modal AuthPage > NavigationStack > Settings > Buttons append to $path
a. Settings { @.Environment(\.openURL) var openURL } was causing continuous changes to the view itself and blocking the whole UI 🥴
b. Solved by replacing OpenURL with `Link(destination:label:)`.

I definitely should’ve been using a Link before but this seems like a #SwiftUWhy
4. Now I need to get those disclosure indicators back in a nice way.
#iOSDev #SwiftUI

Why is there (apparently?) no Picker style on macOS that can be configured with a fixed width, like NSPopUpButton in AppKit?

For example, consider a text field for numeric input followed by a picker for units, both aligned to the right side of a System Settings-style Form. Each time you pick a different unit, the Picker changes width and moves the text field.

This is Apple’s new, favored layout with its new, favored UI framework, but surely this can’t be intended! It’s madness! #SwiftUWhy

I still don’t understand under what conditions Xcode will launch more than one copy of my in-development app (as indicated by its icon appearing twice in the Dock, both running) and how it might relate to SwiftUI previews, but I’m trying not to worry about it too much. #SwiftUWhy

Q: Why is Xcode no longer able to render a preview of my SwiftUI view?

A: *Sometimes*, the answer is that you’ve got a call to a log method on a Logger object in a code path that’s executed when rendering a preview but rarely or not at all otherwise, and this call passes a string without any values interpolated into it (e.g., logger.log(“Hello”)). This causes an error, and this error is only visible in the big spew of output available through the stethoscope icon in the preview pane. #SwiftUWhy

Continued thread

Why in the world does this interface look like this:

.padding(.top, 1)
.padding(.leading, 2)
.padding(.bottom, 3)
.padding(.trailing, 4)

…or this:

.padding(EdgeInsets(top: 1, leading: 2, bottom: 3, trailing: 4))

…instead of the much more idiomatic:

.padding(top: 1, leading: 2, bottom: 3, trailing: 4)

Like, who in the world thought of this foo(.key, value) API interface in a language with named parameters?!

Welcome to my new series on things I don’t understand about Apple’s premier user interface framework. I’m calling it…

#SwiftUWhy

To be clear, these are things I don’t understand, not necessarily things that are “wrong.” They sure *look* wrong (or at least “suboptimal”) to me! But maybe there are good reasons, and I just don’t know them yet. SwiftUI experts and historians, please tell me!

The first entry is coming up…