Created
March 7, 2018 04:36
-
-
Save JacopoMangiavacchi/1e4139ce4dda12ab9d1cc38f93e0702a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Thrift | |
do { | |
let serviceURL: URL = URL(string: "http://localhost:9090")! | |
let session: URLSession = URLSession(configuration: .default) | |
let transport: THTTPSessionTransport = THTTPSessionTransport.Factory(session: session, url: serviceURL).newTransport() | |
let proto = TBinaryProtocol(on: transport) | |
let client = TestServiceClient(inoutProtocol: proto) | |
let result = try client.Hello(HelloString: "Thrift!") | |
print(result) | |
let sampleStruct = try client.GetSampleStruct(key: 3, value: "Three") | |
print("\(sampleStruct.key) \(sampleStruct.value)") | |
} catch let error { | |
print("\(error)") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment