another.im-ios/AnotherIM/xmpp/utils/MemBridge.swift

12 lines
305 B
Swift
Raw Normal View History

2024-06-19 15:06:39 +00:00
import Foundation
enum Mem {
static func bridge<T: AnyObject>(_ obj: T) -> UnsafeMutableRawPointer {
Unmanaged.passUnretained(obj).toOpaque()
}
static func bridge<T: AnyObject>(_ ptr: UnsafeMutableRawPointer) -> T {
Unmanaged<T>.fromOpaque(ptr).takeUnretainedValue()
}
}