DEV Community

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

Posted on


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.

Oldest comments (0)

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.