August 2025
Intermediate to advanced
270 pages
6h 16m
English
Under the Controllers folder, create a new Swift file named MapController. As usual, delete the contents. Then import both SwiftUI and UIKit.
Declare a MapController class but don’t inherit from UIViewController. Instead, inherit from UIHostingController<MapView>.
| | import SwiftUI |
| | import UIKit |
| | |
| | class MapController: UIHostingController<MapView> { |
| | } |
The UI framework we’ve been using up until now is called UIKit. Remember importing UIKit at the top of a few files in previous chapters? From experience, this framework aligns nicely with how Hotwire Native and Rails apps navigate between views. But our map view is built with SwiftUI, ...
Read now
Unlock full access