TGFPasscodeRuleLength
Objective-C
@interface TGFPasscodeRuleLength : TGFPasscodeRule
Swift
class TGFPasscodeRuleLength : TGFPasscodeRule
A concrete passcode rule that validates whether a passcode’s length falls within a globally configured range.
This rule enforces minimum and maximum length requirements for user passcodes.
The length constraints are configured globally using the class methods provided.
If a passcode’s length is outside the minimumLength and maximumLength bounds,
validation will fail with a relevant NSError.
This class is a subclass of TGFPasscodeRule and is used to enforce a passcode policy.
@since 1.3.0
-
Returns the default minimum required passcode length.
Declaration
Objective-C
+ (NSUInteger)defaultMinimumLength;Swift
class func defaultMinimumLength() -> UIntReturn Value
The default minimum length, which is 6.
-
Returns the default maximum allowed passcode length.
Declaration
Objective-C
+ (NSUInteger)defaultMaximumLength;Swift
class func defaultMaximumLength() -> UIntReturn Value
The default maximum length, which is 8.
-
Returns the currently configured minimum required passcode length.
If no value has been set, this will return the
defaultMinimumLength.Declaration
Objective-C
+ (NSUInteger)minimumLength;Swift
class func minimumLength() -> UIntReturn Value
The current minimum length.
-
Configures the global minimum required passcode length.
The length must be between 4 and the current
maximumLength, inclusive. If the provided length is invalid, the current value is retained.Declaration
Objective-C
+ (BOOL)setMinimumLength:(NSUInteger)length;Swift
class func setMinimum(_ length: UInt) -> BoolParameters
lengthThe new minimum length for passcodes.
Return Value
YESif the length was updated successfully;NOotherwise. -
Returns the currently configured maximum allowed passcode length.
If no value has been set, this will return the
defaultMaximumLength.Declaration
Objective-C
+ (NSUInteger)maximumLength;Swift
class func maximumLength() -> UIntReturn Value
The current maximum length.
-
Configures the global maximum allowed passcode length.
The length must be between the current
minimumLengthand 16, inclusive. If the provided length is invalid, the current value is retained.Declaration
Objective-C
+ (BOOL)setMaximumLength:(NSUInteger)length;Swift
class func setMaximum(_ length: UInt) -> BoolParameters
lengthThe new maximum length for passcodes.
Return Value
YESif the length was updated successfully;NOotherwise.