Skip to content

Instantly share code, notes, and snippets.

@TuenTuenna
Created September 21, 2022 06:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TuenTuenna/91c7f68502f8b3cacd9e03cda95d603c to your computer and use it in GitHub Desktop.
Save TuenTuenna/91c7f68502f8b3cacd9e03cda95d603c to your computer and use it in GitHub Desktop.
ios uikit UIView preview Ext
import Foundation
import UIKit

#if DEBUG
import SwiftUI

extension UIView {
    
    private struct ViewRepresentable : UIViewRepresentable {
        
        let uiview : UIView
        
        func updateUIView(_ uiView: UIViewType, context: Context) {
        }
        
        func makeUIView(context: Context) -> some UIView {
            return uiview
        }
        
    }
    func getPreview() -> some View {
        ViewRepresentable(uiview: self)
    }
}


#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment