# MPPFloatBuffer

    class MPPFloatBuffer: NSObject, NSCopying

A wrapper class to store pointer to a float array and its size.
- `
  ### [init(data:length:)](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/MPPFloatBuffer.md.txt#/c:objc(cs)MPPFloatBuffer(im)initWithData:length:)

  ` Initializes a new `FloatBuffer` by copying the elements of the given pointer to a float array. If `data` = `NULL`, all elements of the buffer are initialized to zero.

  #### Declaration

  Swift

      init(data: UnsafePointer<Float>?, length: UInt)

  #### Parameters

  |---|---|
  | `data` | A pointer to a float array whose values are to be copied into the buffer. |
  | `length` | Length of the float array. |

  #### Return Value

  A new instance of `FloatBuffer` initialized with the elements of the given float array.
- `
  ### [init(length:)](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/MPPFloatBuffer.md.txt#/c:objc(cs)MPPFloatBuffer(im)initWithLength:)

  ` Initializes a `FloatBuffer` of the specified length with zeros.

  #### Declaration

  Swift

      init(length: UInt)

  #### Parameters

  |---|---|
  | `length` | Number of elements the `FloatBuffer` can hold. |

  #### Return Value

  A new instance of `FloatBuffer` of the given length and all elements initialized to zero.
- `
  ### [data](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/MPPFloatBuffer.md.txt#/c:objc(cs)MPPFloatBuffer(py)data)

  ` Pointer to float array wrapped by `FloatBuffer`.

  #### Declaration

  Swift

      var data: UnsafeMutablePointer<Float> { get }

- `
  ### [length](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/MPPFloatBuffer.md.txt#/c:objc(cs)MPPFloatBuffer(py)length)

  ` Capacity of the array in number of elements.

  #### Declaration

  Swift

      var length: UInt { get }

- `
  ### [clear()](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/MPPFloatBuffer.md.txt#/c:objc(cs)MPPFloatBuffer(im)clear)

  ` Clears the `FloatBuffer` by setting all elements to zero

  #### Declaration

  Swift

      func clear()