Functions

The following functions are available globally.

  • Converts a date string to formated date string

    Declaration

    Swift

    func convertDateString(expiredDate: String) -> String?

    Return Value

    String?

  • Converts a Date object to a QR format date string

    Declaration

    Swift

    func convertToQrDate(date: Date) -> String

    Return Value

    String

  • Formats a date string by replacing “T” with a space, removing “Z”, and converting it to the local time zone set in the device

    Declaration

    Swift

    func formatDate(_ dateString: String) -> String?

    Return Value

    The formatted date string, or nil if the formatting fails

  • Convert byte array to UIImage

    • bytes: The byte array representing the image data.

    Declaration

    Swift

    func uiImage(from bytes: [UInt8]) -> UIImage

    Return Value

    A UIImage object created from the byte array.

  • Declaration

    Swift

    func preprocessImgSampleBuffer(buffer: CMSampleBuffer) -> Data?
  • Resize the image

    • image: The image to resize.
    • targetSize: The target size of the resized image.

    Declaration

    Swift

    func centerCropToSquareImage(image: UIImage, cropSize: Double) -> UIImage

    Return Value

    The resized UIImage object.

  • Resizing the image and cropping the center part of the image

    • Image :- Pass the image that needs to be croped.
    • TargetSize :- Pass the cropping size of the image.

    Declaration

    Swift

    func resizeAndCenterImage(image: UIImage, targetSize: CGSize) -> UIImage?
  • Get image from sample buffer

    • sampleBuffer: The CMSampleBuffer containing the image data.

    Declaration

    Swift

    func getImageFromSampleBuffer(_ sampleBuffer: CMSampleBuffer) -> UIImage?

    Return Value

    The UIImage object created from the sample buffer.

  • Crop the middle part of the image

    • image: The image to crop.

    Declaration

    Swift

    func cropMiddlePartOfImage(_ image: UIImage) -> UIImage

    Return Value

    The cropped UIImage object.

  • Convert UIImage to CMSampleBuffer

    Declaration

    Swift

    func uiImageToCMSampleBuffer(image: UIImage) -> CMSampleBuffer?

    Parameters

    image

    The UIImage to convert.

    Return Value

    The CMSampleBuffer object created from the UIImage.

  • Saving the proccessed image in the application folder this function is for testing purposes, which can be used to see the frames getting passed to SDK

    • pngData :- Image Data that is getting passed to the process.
    • stateName :- Currecnt state name on which the image was captured.

    Declaration

    Swift

    func saveImageToDocuments(pngData: Data, stateName: String)
  • Function to hide the keyboard.

    Declaration

    Swift

    func hideKeyboard()
  • Returns the diameter of the circle relative to the screen size.

    Declaration

    Swift

    func getCircleDiameter() -> CGFloat
  • get oval width

    Declaration

    Swift

    func getOvalWidth() -> CGFloat
  • get oval height

    Declaration

    Swift

    func getOvalHeight() -> CGFloat
  • Declaration

    Swift

    func configureFirebase()
  • This function converts UIImage to samplebuffer image for proccessing

    Declaration

    Swift

    func imageToSampleBuffer(image: UIImage) -> CMSampleBuffer?
  • Declaration

    Swift

    func sleepFor(seconds: Double)