Skip to content

Commit bfb37a2

Browse files
Zandor300denisenepraunig
authored andcommitted
Add 3D Touch and Force Touch support variables (devicekit#183)
* Add hasForce3dTouchSupport to Device class. * Add 3D Touch support variables for iOS. * Add Force Touch support variables for watchOS.
1 parent dc4b153 commit bfb37a2

File tree

2 files changed

+94
-53
lines changed

2 files changed

+94
-53
lines changed

Source/Device.generated.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,16 @@ public enum Device {
671671
public var hasRoundedDisplayCorners: Bool {
672672
return isOneOf(Device.allDevicesWithRoundedDisplayCorners)
673673
}
674+
675+
/// All devices that have 3D Touch support.
676+
public static var allDevicesWith3dTouchSupport: [Device] {
677+
return [.iPhone6s, .iPhone6sPlus, .iPhone7, .iPhone7Plus, .iPhoneSE, .iPhone8, .iPhone8Plus, .iPhoneX, .iPhoneXS, .iPhoneXSMax]
678+
}
679+
680+
/// Returns whether or not the device has 3D Touch support.
681+
public var has3dTouchSupport: Bool {
682+
return isOneOf(Device.allDevicesWith3dTouchSupport)
683+
}
674684
#elseif os(tvOS)
675685
/// All TVs
676686
public static var allTVs: [Device] {
@@ -691,6 +701,16 @@ public enum Device {
691701
public static var allSimulatorWatches: [Device] {
692702
return allWatches.map(Device.simulator)
693703
}
704+
705+
/// All watches that have Force Touch support.
706+
public static var allWatchesWithForceTouchSupport: [Device] {
707+
return [.appleWatchSeries0_38mm, .appleWatchSeries0_42mm, .appleWatchSeries1_38mm, .appleWatchSeries1_42mm, .appleWatchSeries2_38mm, .appleWatchSeries2_42mm, .appleWatchSeries3_38mm, .appleWatchSeries3_42mm, .appleWatchSeries4_40mm, .appleWatchSeries4_44mm]
708+
}
709+
710+
/// Returns whether or not the device has Force Touch support.
711+
public var hasForceTouchSupport: Bool {
712+
return isOneOf(Device.allWatchesWithForceTouchSupport)
713+
}
694714
#endif
695715

696716
/// All real devices (i.e. all devices except for all simulators)

0 commit comments

Comments
 (0)