Skip to content

Commit b37d147

Browse files
committed
App and Environment: tweak TraitCollection types
Improve the documentation coverage for TraitCollection types. Change some of the values for enumerated types.
1 parent 4ed6b3b commit b37d147

File tree

1 file changed

+52
-13
lines changed

1 file changed

+52
-13
lines changed

Sources/SwiftWin32/App and Environment/TraitCollection.swift

+52-13
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,20 @@ public enum UserInterfaceStyle: Int {
4242
/// Constants that indicate whether the user interface has an active appearance.
4343
public enum UserInterfaceActiveAppearance: Int {
4444
/// The interface has an unspecified appearance.
45-
case unspecified
46-
47-
/// The interface has an active appearance.
48-
case active
45+
case unspecified = -1
4946

5047
/// The interface has an inactive appearance.
5148
case inactive
49+
50+
/// The interface has an active appearance.
51+
case active
5252
}
5353

5454
/// Constants that indicate the interface type for the device or an object that
5555
/// has a trait environment, such as a view and view controller.
5656
public enum UserInterfaceIdiom: Int {
5757
/// An unspecified idiom.
58-
case unspecified
58+
case unspecified = -1
5959

6060
/// An interface designed for a phone.
6161
case phone
@@ -66,52 +66,91 @@ public enum UserInterfaceIdiom: Int {
6666
/// An interface designed for a TV.
6767
case tv
6868

69-
/// An interface designed for a car display.
70-
case car
69+
@available(*, deprecated, message: "Use UserInterfaceIdiom.car")
70+
case carPlay
7171

7272
@available(*, deprecated, renamed: "UserInterfaceIdiom.desktop")
7373
case mac
7474

7575
/// An interface designed for a tablet.
7676
case tablet
7777

78+
/// An interface designed for a car display.
79+
case car
80+
7881
/// An interface designed for a desktop or laptop.
7982
case desktop
8083

8184
/// An interface designed for a AR/VR device.
8285
case headset
8386
}
8487

88+
/// Constants that indicate the visual level for content in the window.
8589
public enum UserInterfaceLevel: Int {
86-
case unspecified
90+
/// An unspecified interface level.
91+
///
92+
/// Choose this option when you want to follow the inherited level.
93+
case unspecified = -1
94+
95+
/// The level for your window's main content.
8796
case base
97+
98+
/// The level for content visually above your window's main content.
8899
case elevated
89100
}
90101

102+
/// Constants that indicate the layout direction associated with the current
103+
/// environment.
91104
public enum TraitEnvironmentLayoutDirection: Int {
92-
case unspecified
105+
/// An unknown layout direction.
106+
case unspecified = -1
107+
108+
/// A left-to-right layout direction.
93109
case leftToRight
110+
111+
/// A right-to-left layout direction.
94112
case rightToLeft
95113
}
96114

115+
/// Constants that indicate the accessibility contrast setting.
97116
public enum AccessibilityContrast: Int {
98-
case unspecified
117+
/// An unspecified contrast.
118+
case unspecified = -1
119+
120+
/// A normal contrast level.
99121
case normal
122+
123+
/// A high contrast level.
100124
case high
101125
}
102126

127+
/// The font weight to apply to text.
128+
///
129+
/// The legibility weight reflects the value of the Bold Text display setting.
103130
public enum LegibilityWeight: Int {
104-
case unspecified
131+
/// An unspecified text weight.
132+
case unspecified = -1
133+
134+
/// A regular font weight.
105135
case regular
136+
137+
/// A bold font weight.
106138
case bold
107139
}
108140

141+
/// Keys that indicate the availability of 3D Touch on a device.
109142
public enum ForceTouchCapability: Int {
143+
/// The availability of 3D Touch is unknown.
144+
///
145+
/// A view has this trait after you create it but before you add it your
146+
/// application's view hierarchy.
110147
case unspecified
111-
case available
112-
case unavailable
113148

149+
/// 3D Touch is available on the device.
150+
case available
114151

152+
/// 3D Touch is not available on the device.
153+
case unavailable
115154
}
116155

117156
private func GetCurrentColorScheme() -> UserInterfaceStyle {

0 commit comments

Comments
 (0)