EZSwiftExtensions icon indicating copy to clipboard operation
EZSwiftExtensions copied to clipboard

Discussions about cross platform support.

Open Khalian opened this issue 9 years ago • 9 comments

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).

Khalian avatar Dec 13 '16 09:12 Khalian

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.

lfarah avatar Dec 13 '16 09:12 lfarah

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.

Esqarrouth avatar Dec 13 '16 09:12 Esqarrouth

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

lfarah avatar Dec 13 '16 09:12 lfarah

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).

Khalian avatar Jan 02 '17 02:01 Khalian

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

Esqarrouth avatar Jan 08 '17 10:01 Esqarrouth

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.

john-wallace-apps avatar Jan 22 '17 16:01 john-wallace-apps

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

Khalian avatar May 28 '17 19:05 Khalian

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.

Khalian avatar Sep 11 '17 02:09 Khalian

Thanks @Khalian. You did an awesome job

lfarah avatar Sep 11 '17 10:09 lfarah