I have a simple SwiftUI wrap with UIKit as display on Playground (using Xcode 12.1)
import UIKit
import PlaygroundSupport
import SwiftUI
struct ContentView: View {
var body: some View {
WrapView()
}
}
struct WrapView: UIViewRepresentable {
func makeUIView(context: Context) -> UIView {
print("makeUIView")
return UIView(frame: .infinite)
}
func updateUIView(_ uiView: UIView, context: Context) {
print("updateUIView")
}
}
PlaygroundPage.current.setLiveView(ContentView())
I'm surprised to see so many calls to makeUIView
and updateUIView
as shown below
makeUIView
updateUIView
makeUIView
updateUIView
makeUIView
updateUIView
makeUIView
updateUIView
updateUIView
updateUIView
updateUIView
updateUIView