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.

  • Resize the image

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

    Declaration

    Swift

    func resizeImage(image: UIImage, targetSize: CGSize) -> UIImage

    Return Value

    The resized UIImage object.

  • 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.

  • Declaration

    Swift

    func saveImageToDocuments(image: UIImage, 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
  • This function converts UIImage to samplebuffer image for proccessing

    Declaration

    Swift

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

    Swift

    func sleepFor(seconds: Double)