import Foundation enum Mem { static func bridge(_ obj: T) -> UnsafeMutableRawPointer { Unmanaged.passUnretained(obj).toOpaque() } static func bridge(_ ptr: UnsafeMutableRawPointer) -> T { Unmanaged.fromOpaque(ptr).takeUnretainedValue() } }