I am trying to set up a new project that supports Thrift 0.12 and Swift 4.2 in Xcode. In my swift files that were generated by Thrift, all of them have the line "import Thrift", but I get a compile error "No such module 'Thrift'". I am at a loss on how to resolve this issue. Importing Thrift as a cocoapod does not seem to work because the latest version I can download though a pod seems to be 0.10, which does not support Swift 4.2. I have Thrift 0.12 downloaded onto my mac, which is how I generated the thrift-to-swift files in the first place. Below is one of the generated files.
I have tried:
pod "Thrift"
and
pod 'Thrift-swift3', :git => '[email protected]:apache/thrift.git', :branch => 'master'
Neither of them work.
My generated swift file:
import Foundation
import Thrift
public final class TTestMessage {
public var title: String?
public var message: String?
public init() { }
public init(title: String?, message: String?) {
self.title = title
self.message = message
}
}
I made a PR for Swift 4.2+ compatibility (https://github.com/apache/thrift/pull/1827) and it was merged.
So a working solution is now the following in your Podfile:
pod 'Thrift', :git => '[email protected]:apache/thrift.git'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With