-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add IBFreeFormViewControllerRepresentable
- Loading branch information
Showing
3 changed files
with
40 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
Sources/UIViewKit/Previews/IBRepresentableForViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<ViewController: UIViewController>: 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 |