52.2 Integrating UIViews into SwiftUI
The individual components that make up the user interface of a UIKit-based application are derived from the UIView class. Buttons, labels, text views, maps, sliders and drawings (to name a few) are all ultimately subclasses of the UIKit UIView class.
To facilitate the integration of a UIView based component into a SwiftUI view declaration, SwiftUI provides the UIViewRepresentable protocol. To integrate a UIView component into SwiftUI, that component needs to be wrapped in a structure that implements this protocol.
At a minimum the wrapper structure must implement the following methods to comply with the UIViewRepresentable protocol:
•makeUIView() – This method is responsible for creating an instance of the UIView-based component, performing any necessary initialization and returning it.
•updateView() – Called each time a change occurs within the containing SwiftUI view that requires the UIView to update...