Supported Types
The following are the supported types and class names which can be wrapped as AnyCloneableData
The following mirror the data types which are available in the app builder and described in the user documentation
πΌData TypesString
CloneableString("hello world")
Number
Currently we support double as a number, we plan to add support for explicit integer support
CloneableNumber(5.23) // accepts double
Boolean
CloneableBoolean(true)
Color
Expects a json string to initialize
CloneableColor("{"r":43,"g":66,"b":188,"a":1}")
Date
CloneableDate(date: Date())
Location
public init(
id: String? = nil, // will be set to a uuid automatically in nil
latitude: Double,
longitude: Double,
altitude: Double? = nil,
additional_properties: [String: CloneableString]? = nil)
CloneableLocation(latitude: 37.7749, longitude: -122.4194, altitude: 10.0, additional_properties: ["key": CloneableString(value: "value")])
Status
Holds a pre-defined state
CloneableStatus("collected")
Unique ID
Uses UUID under the hood. All UUIDs should be used as lowercase
CloneableUUID(UUID())
Array
An array of any other AnyCloneableDataof the same underlying type
CloneableArray([CloneableString("1"), CloneableString("2")])
BoundingBox
Refer to Bounding Box for more information
// class init structure
@objc public init(
id: String, // set to a UUID for best practice
boundingBox: CGRect,
label: String,
confidence: Double,
trackID: Double, // used by tracking. set to something unique
measuredWidth: NSNumber? = nil, // calculated using helper function
measuredHeight: NSNumber? = nil, // calculated using helper function
state: Int, // tracking state if tracked
createdByPerson: Bool = false,
modifiedByPerson: Bool = false,
referenceImageWidth: Int,
referenceImageHeight: Int,
measurementSnapped: Bool = false,
boxSnapPoints: BoxSnapPoints? = nil // set using helper functions
)
let id = "objectID"
let boundingBox = CGRect(x: 0.0, y: 0.0, width: 100.0, height: 100.0)
let label = "Object Label"
let confidence = 0.95
let trackID = 123.45
let measuredWidth: NSNumber? = 50.0
let measuredHeight: NSNumber? = 75.0
let state = 1 // Example tracking state
let createdByPerson = true
let modifiedByPerson = false
let referenceImageWidth = 200
let referenceImageHeight = 200
let measurementSnapped = true
let boxSnapPoints: BoxSnapPoints? = BoxSnapPoints()
let obj = CloneableBoundingBox(id: id,
boundingBox: boundingBox,
label: label,
confidence: confidence,
trackID: trackID,
measuredWidth: measuredWidth,
measuredHeight: measuredHeight,
state: state,
createdByPerson: createdByPerson,
modifiedByPerson: modifiedByPerson,
referenceImageWidth: referenceImageWidth,
referenceImageHeight: referenceImageHeight,
measurementSnapped: measurementSnapped,
boxSnapPoints: boxSnapPoints)
DepthMap
Raw and processed point cloud data from the iphone LiDAR. For more info see Depth Map
We suggest not creating this and using it pre-built from Cloneable's Camera View and Augmented Reality Camera components due to the complexity of processing point clound data from the camera.
public init(depthMap: [[Float]], unprojectedDepth: [[[Float]]], refImgSize: (width: Int, height: Int), depthSize: (width: Int, height: Int), confidenceMap: [[Int]]? = nil) {
self.id = UUID()
self.depthMap = depthMap
self.unprojectedDepth = unprojectedDepth
self.refImgSize = refImgSize
self.depthSize = depthSize
self.confidenceMap = confidenceMap ?? nil
}
Image
Create a UIImage or convert another image type to UIImage
CloneableImage(UIImage)
Last updated