Last active
February 1, 2021 22:56
-
-
Save revblaze/d44b9dd52436c26067ea118c0c14c1d1 to your computer and use it in GitHub Desktop.
Easy and quick device conditionals – a basic necessity.
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
// import UIKit | |
// import SwiftUI | |
struct Device { | |
static let phone = UIDevice.current.userInterfaceIdiom == .phone | |
static let pad = UIDevice.current.userInterfaceIdiom == .pad | |
static let mac = UIDevice.current.userInterfaceIdiom == .mac | |
static let tv = UIDevice.current.userInterfaceIdiom == .tv | |
static let width = UIScreen.main.bounds.size.width | |
static let height = UIScreen.main.bounds.size.height | |
static let size = UIScreen.main.bounds.size | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ie.