Esqarrouth / EZSwiftExtensions

:smirk: How Swift standard types and classes were supposed to work.
MIT License
2.99k stars 380 forks source link

Discussions about cross platform support. #337

Open Khalian opened 7 years ago

Khalian commented 7 years ago

So I have always thought of EZSwiftExtensions as a standard library (kind of like Apache Commons).

Standard libraries of languages have the characteristic of being cross platform. So as a consequence I decided to investigate the feasibility of cross platform support.

I tried spinning up a docker container using https://github.com/swiftdocker/docker-swift. After that I tried https://swift.org/package-manager/ to bundle the module in linux. I was able to get the foundation code to work but not the IOS specific code - (UIKit).

This issue is a discussion if we want to pursue cross platform support and a plan for the same.

  1. Isolate Foundation and UI Extensions into two directories.
  2. Use swift package manager to build it in linux. Keep the devops flow using xcodebuild in IOS.
  3. Write a travis.yml script for linux only builds.
  4. Bundle and distribute the foundation subset of EZSwiftExtensions (This one is an open question on how to best address it).
lfarah commented 7 years ago

I believe our iOS framework should already come with both Foundation and UI Extensions. I don't think our iOS users should have to install both EZSwiftExtensions-UI and EZSwiftExtensions-Foundation directories separately.

Esqarrouth commented 7 years ago

This issue was brought up about a year ago too. It wasn't ready at that time and there weren't enough non-Apple related uses of Swift back then. But times are changing.

I think instead of making 2 separate directories which will confuse the user, we could just add if cases and only compile the code the user can compile?

Like: #if os(iOS)

Also version compatibility is another similar issue. Ideally the user should be able to use the latest version of EZSwift even if they have a different version of Swift. This can be achieved by adding checks like: #if swift(>=3.0) everywhere.

lfarah commented 7 years ago

I agree with everything but the last paragraph. I think it will look like a shitshow with those #if swift(>=3.0) everywhere....

Khalian commented 7 years ago

Ok then should I go ahead and add #if os(iOS) on all UIKit classes (its a little concerning for me to make it architecture specific instead of separating the concerns into different folders).

Esqarrouth commented 7 years ago

Yeah, go ahead. But before check if there is an easier way of doing it, there just might be.

AppsIncorporated commented 7 years ago

Thanks guys, this will be helpful. For my MacOS and Linux apps I've had to copy code into my project that could be based on Foundation rather than UIKit. I'll much prefer being able to use the code without having to modify it.

Khalian commented 7 years ago

I am prioritizing this and started the ball rolling in : https://github.com/goktugyil/EZSwiftExtensions/pull/431

Khalian commented 6 years ago

MacOSx support is complete as of https://github.com/goktugyil/EZSwiftExtensions/commit/e26ca720032dc5232ea655c21eb10ad877a10971. I will begin work on WatchOS when I get the free time.

lfarah commented 6 years ago

Thanks @Khalian. You did an awesome job