Skip to content

Instantly share code, notes, and snippets.

@dkasaj
Last active April 9, 2023 20:45
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save dkasaj/924d12ca791a6f74f4c1a2b516117afc to your computer and use it in GitHub Desktop.
Save dkasaj/924d12ca791a6f74f4c1a2b516117afc to your computer and use it in GitHub Desktop.
// Bigger iPhones = any Max, any Plus, iPhone XR, iPhone 11
switch (UITraitCollection.current.horizontalSizeClass, UITraitCollection.current.verticalSizeClass) {
case (.compact, .compact):
// Smaller iPhones in landscape
case (.compact, .regular):
// iPhones in portrait
// iPads in portrait during any split screen,
// iPads in landscape during 1/3 or 1/2 split screen
case (.regular, .compact):
// Bigger iPhones in landscape
case (.regular, .regular):
// iPads during full screen,
// iPads in landscape during 2/3 split screen,
// iPad Pro 12.9" in landscape during 1/2 split screen
}
@aarblaster
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment