JARMourato / Kodable

A supercharged extension of Codable
MIT License
83 stars 6 forks source link

can remove CRuntime.h #4

Closed erlangzhang closed 3 years ago

erlangzhang commented 3 years ago

you can remove CRuntime.h and create a CBridge.swift file. add code to CBridge.swift

import Foundation

@_silgen_name("swift_getTypeByMangledNameInContext")
public func swift_getTypeByMangledNameInContext(
    _ name: UnsafeMutablePointer<Int8>,
    _ nameLength: Int32,
    _ genericContext: UnsafeRawPointer?,
    _ genericArguments: UnsafeRawPointer?)
-> Any.Type?

@_silgen_name("swift_allocObject")
public func swift_allocObject(
    _ type: UnsafeRawPointer?,
    _ requiredSize: Int32,
    _ requiredAlignmentMask: Int32)
-> UnsafeRawPointer?

hope this will helpful!

JARMourato commented 3 years ago

Hey @erlangzhang yes, that is correct. However that is up to the https://github.com/wickwirew/Runtime library. I only consume it :D

JARMourato commented 3 years ago

Closing this @erlangzhang but you're welcome to open it in the above repository

erlangzhang commented 3 years ago

thanks