2

I have been researching and could not find a full definite answer whether Swift could be possible to study, compile and deploy somewhere.

Will Apple ever allow another platform to use it?

I mean, if it is possible to deploy on certain real life devices, simulators etc.

Robert Columbia
  • 6,313
  • 15
  • 32
  • 40
frankie
  • 115
  • 7
  • You can use it now, to some degree, on Linux. This includes building an Android target and/or a server with Swift. I think there is still a lot of work to do in this area though. – keithbhunter Aug 24 '16 at 20:26
  • 5
    Welcome to SO. Always remember to Google first - a query for `Is it possible to code in swift on Windows?` seems to answer your question perfectly. Thanks! – Pekka Aug 24 '16 at 20:26
  • 1
    Possible duplicate of [How can I develop for iPhone using a Windows development machine?](http://stackoverflow.com/questions/22358/how-can-i-develop-for-iphone-using-a-windows-development-machine) – Adam Aug 24 '16 at 20:28
  • http://stackoverflow.com/questions/39030099/swift-in-windows. – Martin R Aug 24 '16 at 20:36
  • 2
    Swift is open source, apple can't stop anyone from writing a compiler. But you won't be able to use apple's frameworks. – vikingosegundo Aug 24 '16 at 20:51

4 Answers4

7

Straight answer: Yes, you can code, compile and run Swift applications in Windows. In reality, this appears to be more of a curiosity/proof of concept thing than something that is really ready for enterprise use, so I would be wary of choosing Swift under Windows as the platform for a major project.

Supplemental links:

Here is a Swift compiler for Windows: https://swiftforwindows.github.io/

There is an article on Swift under Windows here: http://www.infoworld.com/article/3067364/open-source-tools/swift-for-windows-arrives-at-last-but-as-an-unofficial-port.html

marc-medley
  • 8,931
  • 5
  • 60
  • 66
Robert Columbia
  • 6,313
  • 15
  • 32
  • 40
6

Right now Swift is only for MacOS, iOS and linux devices available. While there are unofficial ports for windows like this one: Swift for Windows and Robert mentioned. The best solution right now to have the latest version of swift and run it is to buy either a Mac or an iOS device or an ubuntu device.

marc-medley
  • 8,931
  • 5
  • 60
  • 66
MatejMecka
  • 1,448
  • 2
  • 24
  • 37
2

Code, debug, run? Yes. Deploy for Windows? No.

There is an unofficial Windows port which is not ready for production, or maybe not even aimed for production, but more like an academic project.

However, let's look at slightly relaxed demands a bit -- that will get much more interesting!

If you only want to:

  1. Practice Swift development on Windows,
  2. contribute to a Swift project with no need to distribute,
  3. or deploy to Linux (like to a server), but develop on Windows,

... then, yes, you can, even using the official tools and with no virtualization trickery.

Windows 10 Anniversary Update comes with the built-in Linux subsystem called "Bash on Ubuntu on Windows", which in turn supports the Linux version of the Swift compiler. With this feature enabled, feel free to develop in your favorite Windows IDE or text editor, and compile to your heart's content on the Bash command line. The Linux subsystem will have full, transparent access through the full Windows file system via mount points at e.g. /mnt/c/, etc.

marc-medley
  • 8,931
  • 5
  • 60
  • 66
Jonas
  • 1,172
  • 1
  • 16
  • 26
1

With a bit of work you'd be able to but not natively which may be what you're looking for.

You can run a virtual instance of Mac OSx using VMWare or something similar but as of now Apple is currently keeping XCode and all development natively on their operating system. Otherwise you're left with third-party solutions like Swift for Mac that don't truly emulate a natural environment.

See this answer for more although it's iPhone focused the foundation behind it all is there: How can I develop for iPhone using a Windows development machine?

EDIT: It looks like Robert Columbia may have a recent solution that may be what you're looking for.

Community
  • 1
  • 1
Adam
  • 518
  • 2
  • 19