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 - iOS Tutorial
From the course: iPadOS 13 Development Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
(Locked)
SwiftUI basics4m 46s
-
Previewing multiple platforms in SwiftUI2m 53s
-
(Locked)
Using SwiftUI to create navigation4m 10s
-
(Locked)
Creating a SwiftUI navigation model3m 4s
-
(Locked)
Setting a default selection2m 58s
-
(Locked)
Working with unsupported views in SwiftUI2m 24s
-
(Locked)
Challenge: Add an image1m 43s
-
(Locked)
Solution: Add an image2m 44s
-
(Locked)
-
-
-
-
-