From the course: iPadOS 13 Development Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Working with unsupported views in SwiftUI

Working with unsupported views in SwiftUI - iOS Tutorial

From the course: iPadOS 13 Development Essential Training

Start my 1-month free trial

Working with unsupported views in SwiftUI

- [Instructor] Let's say you wanted to use a view that's not supported in SwiftUI, but is supported in UIkit. Well, that process is actually pretty easy to do. Let's take a look at doing that for implementing a WKWebView in SwiftUI. Start by creating a new struct, we'll call it WebView, and we're going to extend UIViewRepresentable. And here, we need to implement two methods, the first being makeUIView, and the second being updateUIView. For now, we're just going to look at makeUIView. Make sure you delete the word some in both of these, and in here, we can do this as simply as returning a WKWebView, which we don't have access to, because we haven't imported it, so let's import WebKit, and that should make the error message go away. And then, in our body, all we have to do is create that WebView struct that we just created. That's it, however, at this point, we're not going to see anything, because have haven't loaded a…

Contents