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…
=> More informations about this toot | More toots from siracusa@mastodon.social
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?!
[#]SwiftUWhy
=> More informations about this toot | More toots from siracusa@mastodon.social
@siracusa being able to pass EdgeInsets allows for easier theming IMO, rather than needing to create your own struct and “unwrap” its properties to named parameters… but there’s no reason they couldn’t support named params and EdgeInsets, of course.
=> More informations about this toot | More toots from Drarok@mastodon.social
@Drarok Yes, that’s what I’m saying. By all means, keep the existing methods. But also make the ones that everyone expects to exist as well.
=> More informations about this toot | More toots from siracusa@mastodon.social
text/gemini
This content has been proxied by September (3851b).