Skip to content

Commit 696c600

Browse files
committed
Update RegexRule + RequiredRule
1 parent 2a6c23a commit 696c600

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

SwiftValidator/Rules/RegexRule.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Foundation
1111
/**
1212
`RegexRule` is a subclass of Rule that defines how a regular expression is validated.
1313
*/
14-
public class RegexRule : Rule {
14+
open class RegexRule : Rule {
1515
/// Regular express string to be used in validation.
1616
private var REGEX: String = "^(?=.*?[A-Z]).{8,}$"
1717
/// String that holds error message.
@@ -35,7 +35,7 @@ public class RegexRule : Rule {
3535
- parameter value: String to checked for validation.
3636
- returns: Boolean value. True if validation is successful; False if validation fails.
3737
*/
38-
public func validate(_ value: String) -> Bool {
38+
open func validate(_ value: String) -> Bool {
3939
let test = NSPredicate(format: "SELF MATCHES %@", self.REGEX)
4040
return test.evaluate(with: value)
4141
}
@@ -45,7 +45,7 @@ public class RegexRule : Rule {
4545

4646
- returns: String of error message.
4747
*/
48-
public func errorMessage() -> String {
48+
open func errorMessage() -> String {
4949
return message
5050
}
5151
}

SwiftValidator/Rules/RequiredRule.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Foundation
1111
/**
1212
`RequiredRule` is a subclass of Rule that defines how a required field is validated.
1313
*/
14-
public class RequiredRule: Rule {
14+
open class RequiredRule: Rule {
1515
/// String that holds error message.
1616
private var message : String
1717

@@ -31,7 +31,7 @@ public class RequiredRule: Rule {
3131
- parameter value: String to checked for validation.
3232
- returns: Boolean value. True if validation is successful; False if validation fails.
3333
*/
34-
public func validate(_ value: String) -> Bool {
34+
open func validate(_ value: String) -> Bool {
3535
return !value.isEmpty
3636
}
3737

@@ -40,7 +40,7 @@ public class RequiredRule: Rule {
4040

4141
- returns: String of error message.
4242
*/
43-
public func errorMessage() -> String {
43+
open func errorMessage() -> String {
4444
return message
4545
}
4646
}

0 commit comments

Comments
 (0)