Replies: 1 comment
-
Here's what I came up with. First, here's an LLM-generated Implementation
The whole thing is in an Here's how I implemented it in my app:
It seems to work on my machine. 🤷 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I just bumped into a problem that benefits from a custom layout: a "flow layout" that wraps views when they fill their current line.
On Android, there's an out-of-the-box experimental API for flow layout https://developer.android.com/develop/ui/compose/layouts/flow but on iOS, as far as I know, we have to provide our own layout implementation to handle this.
If I were writing a Swift-only app, I'd probably grab https://github.com/tevelee/SwiftUI-Flow off the shelf, but, as you might expect, it doesn't transpile well, and I'm skeptical about trying to dive in and make it transpile correctly.
Alternately, it's not that hard to implement a flow layout from scratch using the iOS 16
Layout
API. But SkipUI doesn't support that API at all.There is a Compose custom layout API, and I guess it would be possible in principle to re-implement the SwiftUI
Layout
API using that. The API is totally different, though.Even if I just wrote the layout twice, once in SwiftUI and then again in Compose, it's hard to see how to write transpilable Swift in a way that would let me use a SwiftUI
Layout
on iOS and a Compose custom layout on Android.What would y'all recommend I do for flow layouts in my app? What do you recommend in general for handling other kinds of custom layouts? (Radial layouts, masonry, relative stacks, etc.)
Beta Was this translation helpful? Give feedback.
All reactions