Skip to content

Maxatma/ThriftConvertor

Repository files navigation

ThriftConvertor

ThritConvertor - create needed Realm classes from Thrift classes (and mappers to convert them in both directions)

Top class is CodeConverter

Example usage:

    //get .thrift file into String
    let text         = try! String(contentsOf: fileURL)
    
    //create converter using files prefix if needed, some exceptions classes
    let converter    = CodeConverter(prefix: prefix, exceptionNames: [])
    
    //create realm classes from converter into [ContentFile] 
    let realmClasses = converter.createRealmClasses(thriftText: text)
    
    //create mappers between Realm and Thrift objects if needed
    let mappers      = converter.createMapperClasses(thriftText: text)

    //create some base classes and protocols to make everything work
    let bases        = converter.createBaseClasses()
    
    //call base thrift->swift generate utility from Apache
    createBasicThriftGeneratedFiles(fileURL: fileURL)

Contacts

Oleksandr Zaporozhchenko [github] [gmail] [fb] [in]

About

thrift to realm convertor api

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages