4

I have a Cocoa app that I wrote targeting OS X 10.11 using swift and storyboards. Is there a way to port it to Linux and Windows, or at least part of it? (e.g. moving some code a Cocoa framework and using a tool to port it etc.)

I saw this question that mentions Cocotron, but it's only for Objective-C and it seems it's not fully developed.

Thanks for you Advice

Community
  • 1
  • 1
gbdavid
  • 1,639
  • 18
  • 40
  • Probably not easily. You could rewrite your app for [Qt](http://qt.io/) – Basile Starynkevitch Sep 22 '15 at 23:03
  • 2
    Swift != Cocoa. Swift is now open source, but Cocoa/AppKit/UIKit are absolutely not, quite the contrary. See http://stackoverflow.com/a/35041695 and http://stackoverflow.com/a/33466863 for more. – Eric Aya Oct 29 '16 at 23:20

3 Answers3

4

Apple has said that Swift will be open sourced "later this year" and ported to Linux, but they haven't said any such thing about Windows.

JWWalker
  • 22,385
  • 6
  • 55
  • 76
  • ... and as promised, Apple has recently made Swift available open source and released documentation and instructions to use [swift in linux](https://swift.org/blog/swift-linux-port/) :D – gbdavid Dec 03 '15 at 16:00
1

QT is one of the solutions for porting cocoa to windows, but even qt is limited... in a good way. i mean youre not gonna want to program a windows application with ios features in mind like screen shaking. other solutions consist of devolpers porting cocoa functions and they as well as qt can be incomplete even within the realm of possibility like volume buttons and clicking to change views, etc. this is the essence of toolchains and frameworks research those as they are available on swift for windows etc there are several ways that porting code is possible. binary, compiler infrastructure are the things that come to mind sorry if this answer seems uninformative, counter-methodical/"rebellious" or philosophical Edit: cocoapods.org Edit: https://swift.org/blog/swift-on-windows/ Edit: http://www.wxswift.org/ there are currently no libraries for writing swift apps on windows, and cocoa is currently only working on ios macos etc Edit: I recently learned that you can port over existing code onto other platforms via simulation systems like sandboxes and the Wine application on mac which allows 32 bit windows apps to work on mac. if you want to make an app for everyone, then youll have to bundle it with one of those structures - as simple as possible hope you find this useful im a beginner swift programmer so this is new to me too

Bogdan
  • 29
  • 6
0

Apple have begun porting Foundation to Swift for use on other platforms:

https://github.com/apple/swift-corelibs-foundation?files=1

UIKit will be much harder but might happen eventually.

malhal
  • 26,330
  • 7
  • 115
  • 133