Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift coding in visual studio code

Is there any possibility to write swift code and preview in Visual Studio Code (windows coding app)? I see in the guide for swift coding that requires ios system but i have just windows for the moment.

Can I code swift in Windows?

like image 349
P. Alexandru Avatar asked Aug 19 '16 08:08

P. Alexandru


People also ask

Can you code Swift in VS Code?

As Swift is deployed across more platforms, it is important that Swift can be developed on more platforms as well. The Swift Extension for Visual Studio Code provides a cross-platform solution for Swift development supporting macOS, Linux, and Windows.

How do I run a Swift code?

You can run the Swift REPL from the command line and enter Swift code directly into it. Whenever you enter valid Swift code in the REPL, it will immediately compile and run it. Lets play around with the Swift REPL a bit. You can access previous lines that you've entered using $R0 etc.

How run iOS app in VS Code?

hit command + shift + p, then find Launch Emulator and open your created emulator. If your pc is slow then give it some times or restart vsc. let me know more if it fixed or not.

How do I run Swift on Windows?

Step 1: Write a basic program in Swift with your favorite editor. Step 2: Open "Swift for Windows 1.6" and click 'Select File' to choose your file. Step 3: Click 'Compile' to compile your program. Step 4: Click 'Run' to run on Windows.


1 Answers

Yes, you can code Swift on Windows. Check out RemObjects Silver which gives you a Swift compiler in Visual Studio 2015. Visual Studio Express is free, but I don't know if it works with Silver.

Swift itself is just a language. In order to build an iOS app, you need frameworks and libraries like Foundation and UITouch (which can be written in any language, in this case: C, Objective-C and C++). Apple has open sourced many Foundation classes and ported them to Linux but there are lot of stuffs that are not fully implemented or there are bugs in Linux that don't exist in OS X. There's no official Windows port. I doubt Apple will ever open source UITouch at all.

Silver can target .NET (and I guess by extension its cross-platform cousin Mono), Java or Sugar (vendor's proprietary framework). If you want to use Swift on Windows, yes, you can, but don't expect to build an iOS app on Windows. If you are serious about iOS development, buy a Mac, even the $500 Mac Mini can go a long way. If you only want to play with Xcode, assemble a Hackintosh or a virtual machine so that you can run OS X.


Update June 2020: at WWDC 2020, Apple announced Swift 5.3 will expand to include support of Windows and more Linux platforms:

Swift 5.3 is a release meant to include significant quality and performance enhancements. In addition, this release will expand the number of platforms where Swift is available and supported, notably adding support for Windows and additional Linux distributions.

There is official support for Swift on Windows 10. It works with Visual Studio 2019 (not VS Code). Install Swift on Windows

like image 133
Code Different Avatar answered Oct 01 '22 18:10

Code Different