Created
June 28, 2021 21:50
-
-
Save novinfard/d14fd9247f6b8a00ef9599fc42d61105 to your computer and use it in GitHub Desktop.
[Force RTL in SwiftUI]
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
final class SceneDelegate: UIResponder, UIWindowSceneDelegate { | |
func scene(_ scene: UIScene, | |
willConnectTo session: UISceneSession, | |
options connectionOptions: UIScene.ConnectionOptions) { | |
let contentView = ContentView().environment(\.layoutDirection, .rightToLeft) | |
if let windowScene = scene as? UIWindowScene { | |
let window = UIWindow(windowScene: windowScene) | |
window.rootViewController = UIHostingController(rootView: contentView) | |
self.window = window | |
window.makeKeyAndVisible() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment