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

    delay

    Delay Time in double.

    closure

    Closure to call after delay.

  • Converts value to (value * device ratio) considering navigtion bar fixed height.

    Parameter

    Parameter value: Value

    Returns

    Device specific ratio * value

    Declaration

    Swift

    open class func convertToRatioSizedForNavi(_ value:CGFloat) ->CGFloat

    Parameters

    value

    Value

    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 * value

    Declaration

    Swift

    open class func convertToRatio(_ value:CGFloat, sizedForIPad:Bool = false, sizedForNavi:Bool = false) -> CGFloat

    Parameters

    value

    Value

    sizedForIPad

    Bool flag for sizedForIPad

    sizedForNavi

    Bool flag for sizedForNavi

    Return Value

    Device specific ratio * value

  • 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 * value

    Declaration

    Swift

    open class func convertFontSizeToRatio(_ value:CGFloat, fontStyle:String?, sizedForIPad:Bool = false) ->CGFloat

    Parameters

    value

    Value

    fontStyle

    SyncEngine Font Size/ Style

    sizedForIPad

    Bool flag for sizedForIPad

    Return Value

    Device specific ratio * value

  • Converts CGPoint to (point * device ratio).

  • Parameters:

    • value: CGPoint value
    • sizedForIPad: Bool flag for sizedForIPad
  • Returns

    Device specific ratio * point

    Declaration

    Swift

    open class func convertPointToRatio(_ value:CGPoint, sizedForIPad:Bool = false) ->CGPoint

    Parameters

    value

    CGPoint value

    sizedForIPad

    Bool flag for sizedForIPad

    Return Value

    Device specific ratio * point

  • Converts CGSize to (size * device ratio).

  • Parameters:

    • value: CGSize value
    • sizedForIPad: Bool flag for sizedForIPad
  • Returns

    Device specific ratio * size

    Declaration

    Swift

    open class func convertSizeToRatio(_ value:CGSize, sizedForIPad:Bool = false) ->CGSize

    Parameters

    value

    CGSize value

    sizedForIPad

    Bool flag for sizedForIPad

    Return Value

    Device specific ratio * size

  • Validate String for Empty

    Parameter

    Parameter text: String

    Returns

    Bool whether the string is empty or not.

    Declaration

    Swift

    open class func isEmpty(_ text:String?)->Bool

    Parameters

    text

    String

    Return Value

    Bool whether the string is empty or not.

  • Validate String for email regex.

    Parameter

    Parameter text: Sting

    Returns

    Bool whether the string is a valid email or not.

    Declaration

    Swift

    open class func isValidEmail(_ text:String?)->Bool

    Parameters

    text

    Sting

    Return Value

    Bool whether the string is a valid email or not.

  • Validate String for URL regex.

    Parameter

    Parameter text: Sting

    Returns

    Bool whether the string is a valid URL or not.

    Declaration

    Swift

    open class func isValidUrl(_ text:String?) -> Bool

    Parameters

    text

    Sting

    Return Value

    Bool whether the string is a valid URL or not.

  • Validate String for Phone Number regex.

    Parameter

    Parameter text: Sting

    Returns

    Bool whether the string is a valid phone number or not.

    Declaration

    Swift

    open class func isValidPhoneNo(_ text:String?) -> Bool

    Parameters

    text

    Sting

    Return Value

    Bool whether the string is a valid phone number or not.

  • Validate String for number.

    Parameter

    Parameter text: Sting

    Returns

    Bool whether the string is a valid number or not.

    Declaration

    Swift

    open class func isNumeric(_ text:String?) -> Bool

    Parameters

    text

    Sting

    Return Value

    Bool whether the string is a valid number or not.

  • Validate String for alphabetic.

    Parameter

    Parameter text: Sting

    Returns

    Bool whether the string is a valid alphabetic string or not.

    Declaration

    Swift

    open class func isAlphabetic(_ text:String?) -> Bool

    Parameters

    text

    Sting

    Return Value

    Bool whether the string is a valid alphabetic string or not.

  • Validate String for minimum character limit.

    Parameter

    Parameter text: Sting

    Returns

    Bool whether the string is a valid number of characters.

    Declaration

    Swift

    open class func isValidForMinChar(_ text:String?, noOfChar:Int) -> Bool

    Parameters

    text

    Sting

    Return Value

    Bool whether the string is a valid number of characters.

  • Validate String for maximum character limit.

    Parameter

    Parameter text: Sting

    Returns

    Bool whether the string is a valid number of characters.

    Declaration

    Swift

    open class func isValidForMaxChar(_ text:String?, noOfChar:Int) -> Bool

    Parameters

    text

    Sting

    Return Value

    Bool whether the string is a valid number of characters.

  • Validate String for Phone Number regex.

    Parameter

    Parameter text: Sting

    Returns

    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)->Bool

    Parameters

    text

    String

    regex

    Ragex String

    Return Value

    Bool whether the string is a valid regex string.