I'm developing macOS app. I need an ability to delete a created CGRect object.
let rectangle = CGRectMake(0, 0, 30, 30)
How can I do that?
CGRect cannot be deleted since it is just a type of a size, struct and cannot be displayed straight on your UI. (it will be deleted automatically when it goes out of scope in your code.)
A CGRect could be assigned as the frame of a UIView(in iOS)/NSView that can be added to the screen and be deleted later using a reference.
If you want to delete a frame of a view, just assign the frame a CGRect.zero
.
That wont delete the frame but will make the frame to stick to the top left corner of the screen and have a height and width equal to zero.