diff --git a/Sources/UIViewKit/Previews/IBFreeFormViewControllerRepresentable.swift b/Sources/UIViewKit/Previews/IBFreeFormViewControllerRepresentable.swift index 991d51e..9f18ce1 100644 --- a/Sources/UIViewKit/Previews/IBFreeFormViewControllerRepresentable.swift +++ b/Sources/UIViewKit/Previews/IBFreeFormViewControllerRepresentable.swift @@ -29,7 +29,6 @@ public struct IBFreeFormViewControllerRepresentable: UIViewControllerRepresentable { - - public var viewController: ViewController - - public init(_ viewController: @escaping @autoclosure () -> ViewController) { - self.viewController = viewController() - } - - public init(_ viewController: @escaping () -> ViewController) { - self.viewController = viewController() - } +#if DEBUG - public func makeUIViewController(context: Context) -> UIViewController { - viewController - } - - public func updateUIViewController(_ uiViewController: UIViewController, context: Context) { } - -} +import SwiftUI @available(iOS 13.0, *) -struct IBRepresentableForView: UIViewRepresentable { +public struct IBRepresentableForView: UIViewRepresentable { public var view: UIView @@ -58,3 +40,5 @@ struct IBRepresentableForView: UIViewRepresentable { public func updateUIView(_ uiView: UIView, context: Context) { } } + +#endif diff --git a/Sources/UIViewKit/Previews/IBRepresentableForViewController.swift b/Sources/UIViewKit/Previews/IBRepresentableForViewController.swift new file mode 100644 index 0000000..824123e --- /dev/null +++ b/Sources/UIViewKit/Previews/IBRepresentableForViewController.swift @@ -0,0 +1,33 @@ +// +// IBRepresentableForViewController.swift +// UIViewKit +// +// Created by Blazej SLEBODA on 20/09/2023. +// + +#if DEBUG + +import SwiftUI + +@available(iOS 13.0, *) +public struct IBRepresentableForViewController: UIViewControllerRepresentable { + + public var viewController: ViewController + + public init(_ viewController: @escaping @autoclosure () -> ViewController) { + self.viewController = viewController() + } + + public init(_ viewController: @escaping () -> ViewController) { + self.viewController = viewController() + } + + public func makeUIViewController(context: Context) -> UIViewController { + viewController + } + + public func updateUIViewController(_ uiViewController: UIViewController, context: Context) { } + +} + +#endif