This part will demonstrate the code of encapsulating SWiftUI PreviewProvider and how it can be used in UIKit.UIView.
The init function is encapsulated with ViewProvider the view and @ViewBuilder Or specified Size. The type of ViewProvider.viewController is AnyView, which means it will act like a previewer for Preview Provider.
ViewRepresentable is a struct complies with Protocol "UIViewRepresentable"
file: ViewPreviewProvider
You can cache the data that UIView holds and use them when you need to preview your code.
If you are interesting to know more about relative information, please check out PreviewProvider in UIKit UIViewController