-
Notifications
You must be signed in to change notification settings - Fork 147
Closed
Description
I use it with UIKit and preview
but when I use extension UIView preview, I got this error
Return type of instance method 'showPreview(width:height:)' requires that 'some View' conform to 'UIView'
This is my extension code
#if canImport(SwiftUI) && DEBUG
import SwiftUI
extension UIView {
private struct Preview: UIViewRepresentable {
let view: UIView
func makeUIView(context: Context) -> UIView {
return view
}
func updateUIView(_ uiView: UIView, context: Context) {
}
}
func showPreview(width: CGFloat, height: CGFloat) -> some View {
Preview(view: self).previewLayout(.fixed(width: width, height: height)) // error line
}
}
#endifMetadata
Metadata
Assignees
Labels
No labels