contrib/objcwrapper: refactor `init_with_alloc` as an attribute