apocolipse / thrift-swift Goto Github PK
View Code? Open in Web Editor NEWApache Thrift native Swift library
Apache Thrift native Swift library
I'd like to contribute to the repository by migrating it to the latest Swift version 5. Could someone please tell me how to set up the project on macOS 10.15.
swift build returns
"package is using Swift tools version 3.1.0 which is no longer supported; consider using '// swift-tools-version:5.1' to specify the current tools version"
After fixing this I got
"error: the package does not contain a buildable target"
Are there any plans on adding a UDP socket to talk to the RPC service?
I am trying to call a python thrift server running locally on my MacOS computer.. within a Swift App
https://github.com/apocolipse/Thrift-Swift#client-example
I took the client example code as-is and pasted in that along side adding the library as a package to my XCode Project.. but as-is it seems unhappy
Any advice is appreciated
I think I've dropped most of the errors but just want to find a way to confirm my client can work..
$ swift build
/opt/local/dev/Thrift-Swift: error: package at '/opt/local/dev/Thrift-Swift' is using Swift tools version 3.1.0 which is no longer supported; use 4.0.0 or newer instead
$ swift -version
Apple Swift version 5.0.1 (swiftlang-1001.0.82.4 clang-1001.0.46.5)
Target: x86_64-apple-darwin18.6.0
It's slightly related to #21
I'd like to see UDP support, but at the same time I'm not comfortable adding that myself since I'm pretty sure there's a lot of edge cases to tackle (especially when it comes to UDP). One thing I found that is that the on board radio on iPhones do not activate when using UDP, and you need to kick start it by using TCP first.
By using something like IBM/BlueSocket
it would be easier to add support for both UDP and TCP by letting a different component handle network details.
I've create a lightweight HTTPServer support using Swift-Nio.
Source code here: https://github.com/JacopoMangiavacchi/thrift-swift-nio
I've only implemented HTTP transport but it's very easy to extend to Raw Socket too.
If you're interested I can open a Pull Request adding these few classes to this repo.
Best,
-Jacopo
Hello! I have installed thrift via cocoapods. And my project not compiled on Xcode 8 with latest ios10.3 SDK. There are more then 100 errors in Thrift framework. What is problem? The library isn't contributed anymore?
seem TAsyncClient is not completed yet ?
I needed to use TJSONProtocol for a project and hence forked and implemented the json protocol in the following fork:
https://github.com/HojjatK/Thrift-Swift
Note that I have ported the code from C# lib to Swift, the code works fine for me However I need to add more unit-tests
What's the process of If I want to send a pull-request so that it will be part of the official package?
Thank you
Hojjat
Hello, I am a little new to Thrift, but it seems like according to http://thrift.apache.org/docs/Languages,
Swift 4.2 should be supported by Thrift. However, I cannot get it to compile in my project. I have Thrift version 0.12 downloaded on my mac, and used it to generate some swift files. However, all of these swift files have the line "Import Thrift" in them, to which the error "No such module 'Thrift' " pops up. If I place in my podfile [pod 'Thrift-swift3', :git => '[email protected]:apache/thrift.git', :branch => 'master'] or [pod "thrift"], the code does not compile because it seems the version of swift it was written is outdated. If anyone could give give me some insight that would be much appreciated. Sorry if this is a dumb question, but I am at a loss after searching the internet for hours for a solution. Thanks!
Tag needs to be updated and it should be named โ0.0.1โ.
I'm trying to use this library in Swift 4. From what I see, there exist forks that have upgraded to swift 4 (https://github.com/apocolipse/Thrift-Swift/network). See https://github.com/Petro-Lomaka/Thrift-Swift, for example.
The framework they vend seems to work for me.
The command line thrift
, on the other hand, seems not to. I'm trying to use @Petro-Lomaka's fork (same guy), but the generated code doesn't conform to the Thrift swift module. I'm currently trying to uninstall my thrift, then reinstall from brew, and then follow the instructions in #11 with the thrift
fork.
Can we start the process of moving this library to swift 4?
When I use the command will get error:
sh: thrift-gen-swift_3: command not found
plugin process returned non zero exit code: 32512
[WARNING:generation:1] Plugin generator for "swift_3" failed.
Instructions say to use thrift --gen swift_3 thrift_file
, but I'm having trouble understanding how to invoke that.
Where do I get this thrift binary from?
Hello. I'm running into an issue trying to use TFileTransport. Up front, let me say that this might be a mistake on my part as I'm new to both Thrift-Swift and Thrift in general. However, in trying to read an existing thrift file using swift code, I'm seeing a crash in TFileTransport.swift where a Data
buffer is set up using:
var read = Data(capacity: size)
and then used:
read[position] = nextChar
There's no operation that changes the Data
object's actual size before that write, so I believe what's going on here is that while the object has the capacity for size
bytes, it's count
is still zero when the write is attempted. If I've understood the issue correctly, this could be fixed by creating the Data
object as a fixed-sized buffer of zeroed bytes instead of just hinting at the capacity:
var read = Data(count: size)
For context, here's how I'm calling into the thrift code:
guard let transport = try? TFileTransport(filename: filename) else { fatalError() }
try transport.open()
let proto = TBinaryProtocol(on: transport)
let d = try? MyThriftStruct.read(from: proto)
Hi, how to be if I need to pass null value in method to the server,
for example
list<User> getUsers(1: AuthTokenBase64 token, 2: ID systemId, 3: othervalues othertypes);
ID is typealias for String. Parameter systemId can be value or null (on other platforms).
How do I set it as null / nil in swift ?
If thrift file has:
list<User> getUsers(1: AuthTokenBase64 token, 2: optional ID systemId, 3: othervalues othertypes);
we get this:
optional keyword is ignored in argument lists
It's been good to see this project spring back to life to, at least, get up to date with current tooling. That said, the last batch of updates won't get caught by the usual dependency managers because there is no release associated with them.
Whether there's more development planned for the near future or not, would it be a problem to add a new 1.1.1 release so folks using cocoapods/SPM will be able to grab it without forcing a dependency on master
or a specific commit?
Thanks!
Hello!
Faced with issue (tag 1.0.7): Invalid redeclaration of 'description'
appears in all classes where description
property exists
Up to tag 1.0.6 there was no issue.
My struct in .thrift file:
struct TCountryInfo {
1: ID id,
2: string title,
3: string subtitle,
4: string description,
5: string image,
6: ID countryId,
7: Attributes attributes
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.