-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
➕[ADD] UIViewController+ swiftUI 미리보기 (X)
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
Oliveyoung-iOS/Oliveyoung-iOS/Source/Common/Extensions/UIViewController+.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,28 @@ | ||
// | ||
// UIViewController+.swift | ||
// Oliveyoung-iOS | ||
// | ||
// Created by 양정연 on 2022/11/21. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
|
||
#if DEBUG | ||
extension UIViewController { | ||
private struct Preview: UIViewControllerRepresentable { | ||
let viewController: UIViewController | ||
|
||
func makeUIViewController(context: Context) -> UIViewController { | ||
return viewController | ||
} | ||
|
||
func updateUIViewController(_ uiViewController: UIViewController, context: Context) { | ||
} | ||
} | ||
|
||
func toPreview() -> some View { | ||
Preview(viewController: self) | ||
} | ||
} | ||
#endif |