Skip to content

Commit

Permalink
isSecureTextEntry
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanPodymov committed Mar 3, 2024
1 parent 8b63b99 commit be2f164
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
10 changes: 10 additions & 0 deletions Sources/CommonAppleKit/CATextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ public class CATextField: CATextFieldBaseClass {
public required init?(coder: NSCoder) {
super.init(coder: coder)
}

public var isSecureTextEntry: Bool {
get {
true
}

set {

}
}
}

public extension CATextFieldBaseClass {
Expand Down
11 changes: 9 additions & 2 deletions Tests/CommonAppleKitTests/CommonAppleKitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ private final class ViewA: CAView {
label.alignment = .center
addSubview(label)
addSubview(CATextField())
addSubview(CASecureTextField())
let secureTextField = CASecureTextField()
secureTextField.isSecureTextEntry = true
addSubview(secureTextField)
#if canImport(AppKit)
layer?.backgroundColor = CAColor.red.cgColor
#elseif canImport(UIKit)
Expand Down Expand Up @@ -109,7 +111,12 @@ final class CommonAppleKitTests: XCTestCase {
return false
})
XCTAssertTrue(view.subviews.contains { $0 is CATextField })
XCTAssertTrue(view.subviews.contains { $0 is CASecureTextField })
XCTAssertTrue(view.subviews.contains {
guard let secureTextField = $0 as? CASecureTextField else {
return false
}
return secureTextField.isSecureTextEntry
})
}

func testCollectionView() {
Expand Down

0 comments on commit be2f164

Please sign in to comment.