mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-30 13:16:58 +02:00
Add a RTL BuildSetting and use this for SwiftUI views too.
This commit is contained in:
@@ -23,10 +23,18 @@ import SwiftUI
|
||||
struct VectorContentModifier: ViewModifier {
|
||||
|
||||
@ObservedObject private var themePublisher = ThemePublisher.shared
|
||||
@Environment(\.layoutDirection) private var defaultLayoutDirection
|
||||
|
||||
/// The layout direction to use, taking into account the build settings. SwiftUI generally
|
||||
/// handles RTL well enough, but we match the behaviour used in UIKit to avoid mixed layouts.
|
||||
var layoutDirection: LayoutDirection {
|
||||
BuildSettings.disableRightToLeftLayout ? .leftToRight : defaultLayoutDirection
|
||||
}
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
.theme(themePublisher.theme)
|
||||
.environment(\.layoutDirection, layoutDirection)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user