func swap()

in Sources/apm-agent-ios/Instrumentation/MethodSwizzler.swift [37:45]


    func swap(with conversion: (IMPSignature) -> BlockSignature) {
        sync {
            let implementation = method_getImplementation(target)
            let currentObjCImp = unsafeBitCast(implementation, to: IMPSignature.self)
            let newBlock: BlockSignature = conversion(currentObjCImp)
            let newIMP: IMP = imp_implementationWithBlock(newBlock)
            method_setImplementation(target, newIMP)
        }
    }