Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- class ViewController: UIViewController {
- override func viewDidLoad() {
- super.viewDidLoad()
- if UIDevice.isIPad() {
- print("This is an ipad")
- } else {
- print("This is not a ipad")
- }
- }
- }
- extension UIDevice {
- static func isIPad() -> Bool {
- return UIDevice.current.userInterfaceIdiom == .pad
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment