Skip to content

Commit 4b62479

Browse files
Merge pull request #13 from componentskit/change-helpers-access-modifier
change access modifier of the helpers from public to internal
2 parents c21ea7b + 7d31abe commit 4b62479

File tree

5 files changed

+14
-16
lines changed

5 files changed

+14
-16
lines changed

Examples/DemosApp/DemosApp/Login/SwiftUILogin.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ struct SwiftUILogin: View {
2323
@State private var isLoading = false
2424

2525
private var isButtonEnabled: Bool {
26-
return self.email.isNotEmpty
27-
&& self.password.isNotEmpty
26+
return !self.email.isEmpty
27+
&& !self.password.isEmpty
2828
&& self.isConsented
2929
&& (
30-
self.selectedPage == .signUp && self.name.isNotEmpty
30+
self.selectedPage == .signUp && !self.name.isEmpty
3131
|| self.selectedPage == .signIn
3232
)
3333
}

Examples/DemosApp/DemosApp/Login/UIKitLogin.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ final class UIKitLogin: UIViewController {
7676
}
7777

7878
private var isButtonEnabled: Bool {
79-
return self.emailInput.text.isNotEmpty
80-
&& self.passwordInput.text.isNotEmpty
79+
return !self.emailInput.text.isEmpty
80+
&& !self.passwordInput.text.isEmpty
8181
&& self.consentCheckbox.isSelected
8282
&& (
83-
self.pageControl.selectedId == .signUp && self.nameInput.text.isNotEmpty
83+
self.pageControl.selectedId == .signUp && !self.nameInput.text.isEmpty
8484
|| self.pageControl.selectedId == .signIn
8585
)
8686
}
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
import Foundation
22

33
extension Array {
4-
/// Returns the element at the specified index iff it is within bounds, nil otherwise.
5-
/// Complexity: O(1).
4+
/// Returns the element at the specified index if it is within bounds, nil otherwise.
65
///
76
/// - Parameter index: The index of the element to be returned.
87
/// - Returns: The value that corresponds to the index. nil if the value cannot be found.
9-
public subscript(safe index: Index) -> Iterator.Element? {
8+
subscript(safe index: Index) -> Iterator.Element? {
109
return self.isIndexValid(index) ? self[index] : nil
1110
}
1211

1312
/// Checks whether the index is valid for the array.
14-
/// Complexity: O(1).
1513
///
1614
/// - Parameter index: The index to be checked.
1715
/// - Returns: true if the index is valid for the collection, false otherwise.
18-
public func isIndexValid(_ index: Index) -> Bool {
16+
func isIndexValid(_ index: Index) -> Bool {
1917
return index >= self.startIndex && index < self.endIndex
2018
}
2119
}

Sources/ComponentsKit/Helpers/Collection+Helpers.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Foundation
22

33
extension Collection {
44
/// Whether the collection is not empty.
5-
public var isNotEmpty: Bool {
5+
var isNotEmpty: Bool {
66
return !self.isEmpty
77
}
88
}

Sources/ComponentsKit/Helpers/Optional+Helpers.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ import Foundation
22

33
extension Optional {
44
/// Whether the value is nil.
5-
public var isNil: Bool {
5+
var isNil: Bool {
66
return self == nil
77
}
88

99
/// Whether the value is not nil.
10-
public var isNotNil: Bool {
10+
var isNotNil: Bool {
1111
return self != nil
1212
}
1313
}
1414

1515
extension Optional where Wrapped: Collection {
1616
/// Whether the value is not nil and empty.
17-
public var isNotNilAndEmpty: Bool {
17+
var isNotNilAndEmpty: Bool {
1818
if let self {
1919
return self.isNotEmpty
2020
} else {
@@ -23,7 +23,7 @@ extension Optional where Wrapped: Collection {
2323
}
2424

2525
/// Whether the value is nil or empty.
26-
public var isNilOrEmpty: Bool {
26+
var isNilOrEmpty: Bool {
2727
if let self {
2828
return self.isEmpty
2929
} else {

0 commit comments

Comments
 (0)