another.im-ios/AnotherIM/xmpp/utils/MemBridge.swift
2024-12-16 08:19:58 +01:00

12 lines
305 B
Swift

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()
}
}