Skip to content

Commit 9b7b5a2

Browse files
committed
feat: add LICENSE
1 parent e6b0a3b commit 9b7b5a2

File tree

6 files changed

+195
-2
lines changed

6 files changed

+195
-2
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Helbert Gomes
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import Swift
2+
3+
@available(macCatalyst 13.0, macOS 10.15, Windows 10, *)
4+
@available(iOS, unavailable)
5+
@available(tvOS, unavailable)
6+
@available(watchOS, unavailable)
7+
public enum ControlActiveState : String, CaseIterable, Equatable, Hashable {
8+
9+
// MARK: - Case(s).
10+
11+
case key
12+
case active
13+
case inactive
14+
15+
// MARK: - Case Interable.
16+
17+
/// A type that can represent a collection of all values of this type.
18+
public typealias AllCases = [ControlActiveState]
19+
20+
/// A collection of all values of this type.
21+
public static var allCases: [ControlActiveState] { get }
22+
23+
// MARK: - Equatable.
24+
25+
/// Returns a Boolean value indicating whether two values are equal.
26+
///
27+
/// Equality is the inverse of inequality. For any values `a` and `b`,
28+
/// `a == b` implies that `a != b` is `false`.
29+
///
30+
/// - Parameters:
31+
/// - lhs: A value to compare.
32+
/// - rhs: Another value to compare.
33+
public static func == (lhs: ControlActiveState, rhs: ControlActiveState) -> Bool {
34+
lhs.rawValue == rhs.rawValue
35+
}
36+
37+
// MARK: - Hashable.
38+
39+
/// Hashes the essential components of this value by feeding them into the
40+
/// given hasher.
41+
///
42+
/// Implement this method to conform to the `Hashable` protocol. The
43+
/// components used for hashing must be the same as the components compared
44+
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
45+
/// with each of these components.
46+
///
47+
/// - Important: Never call `finalize()` on `hasher`. Doing so may become a
48+
/// compile-time error in the future.
49+
///
50+
/// - Parameter hasher: The hasher to use when combining the components
51+
/// of this instance.
52+
public func hash(into hasher: inout Hasher) {
53+
hasher.combine(rawValue)
54+
}
55+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import Swift
2+
3+
/// The size classes, like regular or small, that you can apply to controls
4+
/// within a view.
5+
@available(iOS 15.0, macOS 10.15, Windows 10, *)
6+
@available(tvOS, unavailable)
7+
@available(watchOS, unavailable)
8+
public enum ControlSize : String, CaseIterable, Equatable, Hashable {
9+
10+
// MARK: - Case(s).
11+
12+
/// A control version that is minimally sized.
13+
case mini
14+
15+
/// A control version that is proportionally smaller size for space-constrained views.
16+
case small
17+
18+
/// A control version that is the default size.
19+
case regular
20+
21+
/// A control version that is prominently sized.
22+
@available(macOS 11.0, Windows 10, *)
23+
case large
24+
25+
// MARK: - Case Interable.
26+
27+
/// A collection of all values of this type.
28+
public static var allCases: [ControlSize] {
29+
if #available(macOS 11.0, Windows 10, *) {
30+
return [ .mini, .small, .regular, .large ]
31+
}
32+
33+
return [ .mini, .small, .regular ]
34+
}
35+
36+
/// A type that can represent a collection of all values of this type.
37+
public typealias AllCases = [ControlSize]
38+
39+
// MARK: - Equatable.
40+
41+
/// Returns a Boolean value indicating whether two values are equal.
42+
///
43+
/// Equality is the inverse of inequality. For any values `a` and `b`,
44+
/// `a == b` implies that `a != b` is `false`.
45+
///
46+
/// - Parameters:
47+
/// - lhs: A value to compare.
48+
/// - rhs: Another value to compare.
49+
public static func == (lhs: ControlSize, rhs: ControlSize) -> Bool {
50+
lhs.rawValue == rhs.rawValue
51+
}
52+
53+
/// Hashes the essential components of this value by feeding them into the
54+
/// given hasher.
55+
///
56+
/// Implement this method to conform to the `Hashable` protocol. The
57+
/// components used for hashing must be the same as the components compared
58+
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
59+
/// with each of these components.
60+
///
61+
/// - Important: Never call `finalize()` on `hasher`. Doing so may become a
62+
/// compile-time error in the future.
63+
///
64+
/// - Parameter hasher: The hasher to use when combining the components
65+
/// of this instance.
66+
public func hash(into hasher: inout Hasher) {
67+
hasher.combine(rawValue)
68+
}
69+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import Swift
2+
3+
/// A type indicating the prominence of a view hierarchy.
4+
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, Windows 10, *)
5+
public enum Prominence : String, Equatable, Hashable {
6+
7+
// MARK: - Case(s).
8+
9+
/// The standard prominence.
10+
case standard
11+
12+
/// An increased prominence.
13+
///
14+
/// - Note: Not all views will react to increased prominence.
15+
case increased
16+
17+
// MARK: - Equatable.
18+
19+
/// Returns a Boolean value indicating whether two values are equal.
20+
///
21+
/// Equality is the inverse of inequality. For any values `a` and `b`,
22+
/// `a == b` implies that `a != b` is `false`.
23+
///
24+
/// - Parameters:
25+
/// - lhs: A value to compare.
26+
/// - rhs: Another value to compare.
27+
public static func == (lhs: Prominence, rhs: Prominence) -> Bool {
28+
lhs.rawValue == rhs.rawValue
29+
}
30+
31+
// MARK: - Hashable.
32+
33+
/// Hashes the essential components of this value by feeding them into the
34+
/// given hasher.
35+
///
36+
/// Implement this method to conform to the `Hashable` protocol. The
37+
/// components used for hashing must be the same as the components compared
38+
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
39+
/// with each of these components.
40+
///
41+
/// - Important: Never call `finalize()` on `hasher`. Doing so may become a
42+
/// compile-time error in the future.
43+
///
44+
/// - Parameter hasher: The hasher to use when combining the components
45+
/// of this instance.
46+
public func hash(into hasher: inout Hasher) {
47+
hasher.combine(rawValue)
48+
}
49+
}

Sources/OpenSwiftUI/User Interface Elements/View Fundamentals/View Modifiers/EnvironmentalModifier.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public protocol EnvironmentalModifier : ViewModifier where Self.Body == Never {
1111

1212
// MARK: - Property(ies).
1313

14-
static var _requiresMainThread: Swift.Bool { get }
14+
static var _requiresMainThread: Bool { get }
1515

1616
// MARK: - Function(s).
1717

Sources/OpenSwiftUI/User Interface Elements/View Fundamentals/View Modifiers/_ViewModifier_Content.swift

-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ public struct _ViewModifier_Content<Modifier> : View where Modifier: ViewModifie
99
// MARK: - Property(ies).
1010

1111
public var body: Never { fatalError() }
12-
1312
}

0 commit comments

Comments
 (0)