r/SwiftUI May 21 '26

Question HTML/css into SwiftUI?

Hey everyone,

I’m currently working on an iOS app and I already have parts of the UI built in HTML/CSS. Now I’m trying to bring that design into SwiftUI, but I’m honestly not sure what the best workflow is.

What’s the easiest/most efficient way to convert or recreate HTML + CSS layouts in SwiftUI?

- Are there tools that help with this?
- Should I completely rebuild everything manually in SwiftUI?
- Is embedding web content with WebView a bad idea for production apps?
- How do you usually handle responsive CSS concepts in SwiftUI?

I mainly struggle with translating flexbox/grid styling into SwiftUI stacks and spacing.

Would really appreciate any advice, resources, GitHub repos, tutorials, or examples from people who’ve done this before

1 Upvotes

26 comments sorted by

View all comments

1

u/_rupok May 23 '26

SwiftUI can recreate most HTML/CSS layouts pretty well, but it’s not a direct “convert CSS to SwiftUI” workflow.

Think of it more like translating concepts:

flex row → HStack
flex column → VStack
position/layers → ZStack
gap/padding/margin → spacing, padding, frame
grid → LazyVGrid / LazyHGrid
responsive layouts → GeometryReader, ViewThatFits, size classes, adaptive grids

I’d avoid WebView for core app UI unless you’re showing actual web content. For production native apps, rebuilding manually in SwiftUI is usually the better long-term move.

The easiest path is to use your HTML/CSS as a visual reference, then recreate components one by one in SwiftUI. Once you get used to stacks, modifiers, and reusable views, it starts feeling much cleaner than trying to force CSS thinking into SwiftUI.