mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-24 02:22:44 +02:00
get rid of additional UIHostingController. Cleanup and comments.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
import Combine
|
||||
|
||||
/**
|
||||
UIHostingController that applies some app-level specific configuration
|
||||
@@ -25,7 +26,9 @@ class VectorHostingController: UIHostingController<AnyView> {
|
||||
|
||||
// MARK: Private
|
||||
|
||||
private let forceZeroSafeAreaInsets: Bool
|
||||
private var theme: Theme
|
||||
private var heightSubject = CurrentValueSubject<CGFloat, Never>(0)
|
||||
|
||||
// MARK: Public
|
||||
|
||||
@@ -40,8 +43,12 @@ class VectorHostingController: UIHostingController<AnyView> {
|
||||
var enableNavigationBarScrollEdgeAppearance = false
|
||||
/// When non-nil, the style will be applied to the status bar.
|
||||
var statusBarStyle: UIStatusBarStyle?
|
||||
|
||||
private let forceZeroSafeAreaInsets: Bool
|
||||
/// Whether or not to publish when the height of the view changes
|
||||
var publishHeightChanges: Bool = false
|
||||
/// The publisher to subscribe to if `publishHeightChanges` is enabled.vi
|
||||
var heightPublisher: AnyPublisher<CGFloat, Never> {
|
||||
return heightSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
override var preferredStatusBarStyle: UIStatusBarStyle {
|
||||
statusBarStyle ?? super.preferredStatusBarStyle
|
||||
@@ -104,6 +111,10 @@ class VectorHostingController: UIHostingController<AnyView> {
|
||||
if #available(iOS 15.0, *) {
|
||||
self.view.invalidateIntrinsicContentSize()
|
||||
}
|
||||
if publishHeightChanges {
|
||||
let height = sizeThatFits(in: CGSize(width: self.view.frame.width, height: UIView.layoutFittingExpandedSize.height)).height
|
||||
heightSubject.send(height)
|
||||
}
|
||||
}
|
||||
|
||||
override func viewSafeAreaInsetsDidChange() {
|
||||
|
||||
Reference in New Issue
Block a user