DEV Community

Cover image for Fixing SwiftUI navigation with UIKit
Raksha for Canopas Software

Posted on

2

Fixing SwiftUI navigation with UIKit

You must be aware that Apple hasn’t implemented SwiftUI from scratch, those SwiftUI views are just wrappers around UIKit views. 

While SwiftUI makes development easy and fun, Apple did a terrible job with some of the basics like navigation and tabs.

It doesn’t have all the capabilities that UIKit had and has a few major bugs as well like
You can not do multiple operations on NavigationView/Stack (Want to pop 1 view and push a new one at the same, not possible.)
It’s not possible to observe current views in NavigationStack (How can we take decisions based on stack apple?)
Terrible animations whenever multiple views are popped off the stack.
You can not control whether push/pop operations should be animated
TabView does not have native behavior of popping stack and scrolling to the top when tapped multiple times (Really apple?)

Those are only some of the things, you will discover much more as you use SwiftUI.

In today’s article, you will see how you can wrap UIKit navigation with SwiftUI. You will be amazed at how easy and simple it is.

For detailed implementation, visit canopas blog.

Sentry mobile image

Mobile Vitals: A first step to Faster Apps

Slow startup times, UI hangs, and frozen frames frustrate users—but they’re also fixable. Mobile Vitals help you measure and understand these performance issues so you can optimize your app’s speed and responsiveness. Learn how to use them to reduce friction and improve user experience.

Read the guide →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay