Skip to content

Instantly share code, notes, and snippets.

@usagimaru
Created December 9, 2023 08:44
Show Gist options
  • Save usagimaru/9b8e93f0f239195a8cb46fee28cda7e7 to your computer and use it in GitHub Desktop.
Save usagimaru/9b8e93f0f239195a8cb46fee28cda7e7 to your computer and use it in GitHub Desktop.
Right-align items in NSStackView
// If the current layout is LTR, right justified. [3, 2, 1, 0]
// If RTL, left justified. [0, 1, 2, 3]
if self.userInterfaceLayoutDirection == .leftToRight {
stackView.userInterfaceLayoutDirection = .rightToLeft
}
else {
stackView.userInterfaceLayoutDirection = .leftToRight
}
// https://developer.apple.com/documentation/appkit/nsview/1483254-userinterfacelayoutdirection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment