How to Access the UIKit Components Under SwiftUI Objects

How to disable scrolling in a list by accessing the UIScrollView and more

Photo by Edo Nugroho on Unsplash.

SwiftUI was the talk of the town during WWDC 2019. Despite the limited set of tools, it created a euphoria due to the ease with which you can build user interfaces. Gladly, a lot of the SwiftUI components are built on top of UIKit. Besides, the SwiftUI and UIKit interoperability allows us to harness UIViewRepresentable and UIViewControllerRepresentable — both of which let you port UIKit components into SwiftUI.

But we already know that! So what’s the purpose of this article?

In the next few sections, we’ll look into an amazing SwiftUI library (Introspect) that lets us access the underlying UIKit views.

We’ll cover the following topics: