How to dealloc UnsafeMutablePointer referenced from Swift struct

Viewed 709

If I have a Swift struct like this:

struct ViewBox {
    let pointer: UnsafeMutablePointer<UIView>
    init() {
        pointer = UnsafeMutablePointer<UIView>.alloc(1)
    }
}

how should I ensure, that the pointer is properly deallocated, when the struct is deallocated? I can't use deinit or dealloc methods for Swift structs.

Or I don't have to care and it's happening automatically?

1 Answers
Related