Handling the new "Forming 'UnsafeRawPointer'..." warning

Given the ongoing travails associated with &, I always wondered why folks didn’t just switch to malloc:

class Container {
    static let key = malloc(1)!
    
    func getObject() -> Any? {
        return objc_getAssociatedObject(self, Container.key)
    }
}

Share and Enjoy

Quinn “The Eskimo!” @ DTS @ Apple

13 Likes