eleven / ocho Public

Clone
git clone https://amadan.net/eleven/ocho

Plain git — no account needed to clone.

Download

Download this file

1import UIKit
2
3// Device-naming copy — "removed from this iPhone" — must follow the run target
4// rather than hard-code one. This iOS binary runs on three surfaces: iPhone,
5// iPad, and (via "Designed for iPad" on Apple Silicon) a Mac. `isiOSAppOnMac`
6// catches that last case, which otherwise reports the `.pad` idiom and would
7// mislabel a Mac as an iPad. (The genuinely-native macOS app is a separate
8// target with its own copy; this covers the iOS app running on a Mac.)
9enum DeviceName {
10 static var current: String {
11 if ProcessInfo.processInfo.isiOSAppOnMac { return "Mac" }
12 return UIDevice.current.userInterfaceIdiom == .pad ? "iPad" : "iPhone"
13 }
14}
15