CGRect Values append in Array

Hi I try to safe x, y, width and height values from a Objekt detection AI in a Array.

rectangle = CGRect(x: boundingBox.minX*image.size.width, y: (1-boundingBox.minY-boundingBox.height)*image.size.height, width: boundingBox.width*image.size.width, height: boundingBox.height*image.size.height)
var XPoitions: [Double] = Array()
XPoitions.append(rectangle.origin.x)

The Error say "No exact matches in call to instance method 'append'". And i am not sure how to fix it......

Answered by HawkingseinVater in 677429022

Sry. 😅 found a way... Better Question: How can i delete this question?

Maybe a type mismatch: Double (XPoitions expects Double) vs CGFloat (rectangle.origin.x).

Try:

XPoitions.append(Double(rectangle.origin.x))

Or declare:

var xPositions = [CGFloat]()
CGRect Values append in Array
 
 
Q