mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Delete some unused code.
This commit is contained in:
@@ -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<Content: View>(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
|
||||
|
||||
Reference in New Issue
Block a user