Skip to content

Instantly share code, notes, and snippets.

@novinfard
Last active June 29, 2021 00:50
Show Gist options
  • Save novinfard/3f47af24d13d1e7d7a0281a04a25a1cd to your computer and use it in GitHub Desktop.
Save novinfard/3f47af24d13d1e7d7a0281a04a25a1cd to your computer and use it in GitHub Desktop.
[SwiftUI preview in RTL and LTR]
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
Group {
ContentView()
.environment(\.layoutDirection, .leftToRight)
.previewDisplayName("Left to Right")
ContentView()
.environment(\.layoutDirection, .rightToLeft)
.previewDisplayName("Right To Left")
}
.previewLayout(.fixed(width: 400, height: 200))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment