izqui / Taylor

A lightweight library for writing HTTP web servers with Swift
MIT License
926 stars 79 forks source link

Planned Cross-Platform support? #13

Open codynhat opened 8 years ago

codynhat commented 8 years ago

With Swift being released as open source soon, are there any plans to make this project cross-platform? Specifically, Linux? I know Apple is planning on releasing a compiler for Linux. It would be awesome to have a robust Swift web framework that can run on a Linux web server.

Danappelxx commented 8 years ago

+1

izqui commented 8 years ago

Yes! That's the idea, but we it is difficult to anticipate without knowing what will be allowed in Linux Swift.

The first step I took towards that goal is abstracting the Socket protocol, in case we can't use CocoaAsyncSocket when it launches, to make the transition easily.

The other thing that bugs me is that it relies heavily on Foundation (lots of NSData around) and it is unclear whether it could be used from Linux.

Long story short, making it cross-platform is definitely the goal and we would love to have as much help as posible.

Thanks for the interest.

codynhat commented 8 years ago

Looks like Node.js is built on https://github.com/libuv/libuv. Could that be an option?

Danappelxx commented 8 years ago

There's a lot of socket libraries around in c and objective-c - I even found one in Swift without any Foundation dependencies. I agree with @izqui though, you can't really predict how much control over Swift Apple is going to give, so it's kind of useless to find another dependency that could be just as likely to be unusable when Swift does go open source. I would instead try to get rid of as much Foundation use in Taylor as possible, since it is very unlikely that Apple will open source it.

perezpaya commented 8 years ago

@Danappelxx +1

izqui commented 8 years ago

I started implementing the socket protocol with the library @Danappelxx introduced.

I got it to work, but I have this little issue that I'm trying to figure out now https://github.com/AlwaysRightInstitute/SwiftSockets/issues/10

I started working on it in the swiftsockets branch https://github.com/izqui/Taylor/blob/swiftsockets/Taylor/Socket.swift

izqui commented 8 years ago

Ups, something is weird with the headers also, will have to look at it in more detail.

izqui commented 8 years ago

Solved! swiftsockets is working now :)

Danappelxx commented 8 years ago

Nice!

Danappelxx commented 8 years ago

Now that Swift is open source, I think we should work on making Taylor linux compatible. I put some thought into this and I believe the biggest thing stopping us is the use of Foundation - most importantly NSData. The solution I see popping up is using [Int8] for bytes, and I think we should do the same.

jhoughjr commented 8 years ago

Might be old news, but I believe Foundation is working in Linux under Swift 2.2 according to Swift.org.