GISTUtility
open class GISTUtility: NSObject
Class for Utility methods.
-
Bool flag for device type.
Declaration
Swift
@nonobjc open static let isIPad:Bool = UIDevice.current.userInterfaceIdiom == .pad;
-
Function to delay a particular action.
- Parameters:
- delay: Delay Time in double.
- closure: Closure to call after delay.
Declaration
Swift
public class func delay(_ delay:Double, closure:@escaping () -> Void)Parameters
delayDelay Time in double.
closureClosure to call after delay.
- Parameters:
-
Converts value to (value * device ratio) considering navigtion bar fixed height.
Parameter
Parameter value: ValueReturns
Device specific ratio * valueDeclaration
Swift
open class func convertToRatioSizedForNavi(_ value:CGFloat) ->CGFloatParameters
valueValue
Return Value
Device specific ratio * value
-
Converts value to (value * device ratio).
- Parameters:
- value: Value
- sizedForIPad: Bool flag for sizedForIPad
- sizedForNavi: Bool flag for sizedForNavi
Returns
Device specific ratio * valueDeclaration
Swift
open class func convertToRatio(_ value:CGFloat, sizedForIPad:Bool = false, sizedForNavi:Bool = false) -> CGFloatParameters
valueValue
sizedForIPadBool flag for sizedForIPad
sizedForNaviBool flag for sizedForNavi
Return Value
Device specific ratio * value
- Parameters:
-
Converts value with font size/style to (value * device ratio).
- Parameters:
- value: Value
- fontStyle: SyncEngine Font Size/ Style
- sizedForIPad: Bool flag for sizedForIPad
Returns
Device specific ratio * valueDeclaration
Swift
open class func convertFontSizeToRatio(_ value:CGFloat, fontStyle:String?, sizedForIPad:Bool = false) ->CGFloatParameters
valueValue
fontStyleSyncEngine Font Size/ Style
sizedForIPadBool flag for sizedForIPad
Return Value
Device specific ratio * value
- Parameters:
-
Converts CGPoint to (point * device ratio).
- Parameters:
- value: CGPoint value
- sizedForIPad: Bool flag for sizedForIPad
Returns
Device specific ratio * pointDeclaration
Swift
open class func convertPointToRatio(_ value:CGPoint, sizedForIPad:Bool = false) ->CGPointParameters
valueCGPoint value
sizedForIPadBool flag for sizedForIPad
Return Value
Device specific ratio * point
- Parameters:
-
Converts CGSize to (size * device ratio).
- Parameters:
- value: CGSize value
- sizedForIPad: Bool flag for sizedForIPad
Returns
Device specific ratio * sizeDeclaration
Swift
open class func convertSizeToRatio(_ value:CGSize, sizedForIPad:Bool = false) ->CGSizeParameters
valueCGSize value
sizedForIPadBool flag for sizedForIPad
Return Value
Device specific ratio * size
- Parameters:
-
Validate String for Empty
Parameter
Parameter text: StringReturns
Bool whether the string is empty or not.Declaration
Swift
open class func isEmpty(_ text:String?)->BoolParameters
textString
Return Value
Bool whether the string is empty or not.
-
Validate String for email regex.
Parameter
Parameter text: StingReturns
Bool whether the string is a valid email or not.Declaration
Swift
open class func isValidEmail(_ text:String?)->BoolParameters
textSting
Return Value
Bool whether the string is a valid email or not.
-
Validate String for URL regex.
Parameter
Parameter text: StingReturns
Bool whether the string is a valid URL or not.Declaration
Swift
open class func isValidUrl(_ text:String?) -> BoolParameters
textSting
Return Value
Bool whether the string is a valid URL or not.
-
Validate String for Phone Number regex.
Parameter
Parameter text: StingReturns
Bool whether the string is a valid phone number or not.Declaration
Swift
open class func isValidPhoneNo(_ text:String?) -> BoolParameters
textSting
Return Value
Bool whether the string is a valid phone number or not.
-
Validate String for number.
Parameter
Parameter text: StingReturns
Bool whether the string is a valid number or not.Declaration
Swift
open class func isNumeric(_ text:String?) -> BoolParameters
textSting
Return Value
Bool whether the string is a valid number or not.
-
Validate String for alphabetic.
Parameter
Parameter text: StingReturns
Bool whether the string is a valid alphabetic string or not.Declaration
Swift
open class func isAlphabetic(_ text:String?) -> BoolParameters
textSting
Return Value
Bool whether the string is a valid alphabetic string or not.
-
Validate String for minimum character limit.
Parameter
Parameter text: StingReturns
Bool whether the string is a valid number of characters.Declaration
Swift
open class func isValidForMinChar(_ text:String?, noOfChar:Int) -> BoolParameters
textSting
Return Value
Bool whether the string is a valid number of characters.
-
Validate String for maximum character limit.
Parameter
Parameter text: StingReturns
Bool whether the string is a valid number of characters.Declaration
Swift
open class func isValidForMaxChar(_ text:String?, noOfChar:Int) -> BoolParameters
textSting
Return Value
Bool whether the string is a valid number of characters.
-
Validate String for Phone Number regex.
Parameter
Parameter text: StingReturns
Bool whether the string is a valid phone number or not. Validate String for a regex.
Parameters:
- text: String
- regex: Ragex String
Returns
Bool whether the string is a valid regex string.
Declaration
Swift
open class func isValidForRegex(_ text:String?, regex:String)->BoolParameters
textString
regexRagex String
Return Value
Bool whether the string is a valid regex string.
View on GitHub
GISTUtility Class Reference