diff --git a/Modules/RSCore/Sources/RSCore/UIKit/UIViewController+RSCore.swift b/Modules/RSCore/Sources/RSCore/UIKit/UIViewController+RSCore.swift index d13ebf948..cf2000707 100644 --- a/Modules/RSCore/Sources/RSCore/UIKit/UIViewController+RSCore.swift +++ b/Modules/RSCore/Sources/RSCore/UIKit/UIViewController+RSCore.swift @@ -5,6 +5,7 @@ // Created by Maurice Parker on 4/15/19. // Copyright © 2019 Ranchero Software. All rights reserved. // + #if os(iOS) import UIKit import SwiftUI @@ -23,32 +24,4 @@ extension UIViewController { self.present(alertController, animated: true, completion: nil) } } - -// MARK: SwiftUI - -public struct ViewControllerHolder { - public weak var value: UIViewController? -} - -public struct ViewControllerKey: EnvironmentKey { - public static var defaultValue: ViewControllerHolder { return ViewControllerHolder(value: nil ) } -} - -extension EnvironmentValues { - public var viewController: UIViewController? { - get { return self[ViewControllerKey.self].value } - set { self[ViewControllerKey.self].value = newValue } - } -} - -extension UIViewController { - public func present(style: UIModalPresentationStyle = .automatic, @ViewBuilder builder: () -> Content) { - let controller = UIHostingController(rootView: AnyView(EmptyView())) - controller.modalPresentationStyle = style - controller.rootView = AnyView( - builder().environment(\.viewController, controller) - ) - self.present(controller, animated: true, completion: nil) - } -} #endif