VkCommandBuffer should be imported as
OpaquePointer?, in which case you can just do
If, for whatever reason, you don't have the correct nullability being imported, you can do
Int32(Int(bitPattern: ptr)) where
ptr is an
OpaquePointer to convert it to an Int32; however, the better option is to fix the nullability. You may have
NS_ASSUME_NONNULL being defined somewhere where it shouldn't be, for example.
Edit: oops, as @jrose says,
Int(bitPattern: ptr) is safe but the conversion to
Int32 afterwards is most definitely not. The
Int32 should be converted to an
Int before comparison if you’re going that route.