DeviceClass.swift 868 B

123456789101112131415161718192021222324
  1. /// A class of devices. Used to determine adaptive sizing behaviour such as
  2. /// the sizes of the various dynamic ``Font/TextStyle``s.
  3. public struct DeviceClass: Hashable, Sendable {
  4. @_spi(Backends) public enum Kind: Sendable {
  5. case desktop
  6. case phone
  7. case tablet
  8. case tv
  9. case watch
  10. }
  11. @_spi(Backends) public var kind: Kind
  12. /// The device class for laptops and desktops.
  13. public static let desktop = Self(kind: .desktop)
  14. /// The device class for smartphones.
  15. public static let phone = Self(kind: .phone)
  16. /// The device class for tablets (e.g. iPads).
  17. public static let tablet = Self(kind: .tablet)
  18. /// The device class for smart TVs (e.g. Apple TVs).
  19. public static let tv = Self(kind: .tv)
  20. /// The device class for smart watches.
  21. public static let watch = Self(kind: .watch)
  22. }