I see Swift are primarily used for Apple Device programming... But Swift are now Open source so is it good idea to use Swift for NON Apple OS GUI Apps ? If yes can you guys tell me what GUI Framework should i use (I'm new to programming and still confused about it)
Whether or not it would be a good idea for you to use Swift depends on your needs.
To be up-front about it, Swift on non-Apple platforms obviously doesn't have the same kind of resources behind it as it does on Apple platforms. Things like setting up your development environment may be a bit more involved, and the system libraries are not designed for ease of use from Swift.
As for UI frameworks, here are a handful of community projects I found:
- GitHub - stackotter/swift-cross-ui: A cross-platform SwiftUI-like UI framework built on Gtk4. is a SwiftUI-style framework which supports Windows, Mac, and Linux.
- GitHub - compnerd/swift-win32: A Windows application framework for Swift is a familiar model-view-controller-style framework for Windows.
- GitHub - ctreffs/SwiftImGui: Swift wrapper around Dear imgui for macOS, iOS, Linux and Windows might be a good choice for something a bit more minimalist.
I use Swift for cross-platforms applications successfully, i.e. they run on macOS, Linux, and Windows. They are currently command-line only, but I have planned a Windows GUI for one application, I hope The Browser Company will release a nice GUI library for Windows soon. For Linux there e.g. are some wrappers around GTK, see this other forums topic. But I think you should not hope for a good single cross-platform GUI library soon, you certainly will have to do some re-implementation of the GUI for each platform family.
Yes, the Linux and Windows versions of Swift sometimes lag behind the version for Apple platforms (regular expression literals, macros). You might also consider how “secure” the future is for other than the Apple platforms in the long term. From what I heard Apple itself is using Swift on Linux. A while ago some doubts might have been justified for Windows, but I think now the future looks very good even for Windows, even Apple’s Swift team is very positive about Swift on Windows and even help — but you will have to judge for yourself after being part of the community for some time. Programming cross-platforms application will be much nicer once the common standard libraries are finished.
The interesting part about using Swift as a cross-platform language is that I think Swift could be a very nice “successor” to C++, and Swift is better accessible for beginners than Rust, which is often treated as another candidate in this space. And the Swift implementation on Windows is very interesting, because it integrates natively into Windows so to speak, making it a “true native” choice for Windows. And of course you can “naturally” program apps for Apple’s devices.
There's also an effort to support Qt:
I'm still Learning about using swift-win32 but I'm really blind to programming since i was started now, there also lacks of Documentation from swift-win32 (either they lack Documentation or i didn't understand it) :(
I couldn't find a good tutorial for properly use swift-win32 sadly
If you mean the GUI package, I would rather wait a bit what The Browser Company will hopefully release soon.
(If you are new to programming, you should rather start with simple command line applications first, using Visual Studio Code with the Swift extension by the Swift server group if you are on Windows. You will have to learn about the language itself and the Swift Package Manager.)
I've also done a bit of research in this area of cross-platform UI wrappers –
although my use case is embedded Linux, so may be different to the OP.
In any case, Swift seems pretty well supported in Linux, not without its issues (occasional compiler bug etc) but I am comfortable enough to bet my project on it. The new cross-platform Foundation should improve things somewhat too.
I'm sorry what is The Browser Company ?
As others have noted, it's possible to use Swift elsewhere, but the support on Apple platforms is greatest.
As a new learner, you might want to try to get the most supportive language and environment possible so you can do more learning than logistics.
Swift on MacOS is by far my favorite. Swift makes many things very easy. If you don't have a mac, getting (a used?) one would likely pay back in time saved and lessons learned significantly.
Just realize that both Swift and Apple are very ambitious. Swift has more features than other languages, and Apple API's and platforms are diverse. You'll have to avoid being distracted by all the shiny toys
Java could be a good starting language, using IntelliJ or eclipse. Java expressly avoids platform diversity, it's easier to stick with the simpler subset of the language, and the tutorial/teaching ecosystem is highly evolved. (You might learn Swift faster by starting with
Focusing on data and algorithms, and how data is encoded for algorithms, might give you a good feel for the power and joy of programming.
I also have a bunch of command line tools that work on both Mac and Linux. And while
Foundation on non-Apple platforms has a lot of problems, you can get pretty far with a bit of hacking.
By now I'm all in with Swift, so I would not consider using another language for the UI – no matter which platform. That means you're left with only a few options and many (in particular the declarative ones) still in their infancies. If I were to go for a "classic" UI toolkit, I'd use Qt, it's probably the most mature open source UI toolkit on Linux and Windows these days. That said,
https://github.com/Longhanks/qlift unfortunately looks almost abandoned. Perhaps something new using the C++ interoperability would be a better approach.
Yeah, this is what I was talking about.
Since you are new to programming (not just new to Swift - new to programming overall), I would recommend that you start with something more established so you can focus on getting comfortable with programming.
The language doesn't matter so much. Most professionals use (or have used) multiple languages, and when they join a new project, the idea that they would have to use a different programming language is usually not a significant barrier. The language is just a tool that allows developers to express themselves.
On Apple platforms, the developer experience is supported full-time by a large staff of experienced engineers. That leads to an experience where you can just download Xcode, click "New Project > App", and pretty much start coding straight away from there. Swift on other platforms is generally supported by passionate members of the community on a volunteer basis. They do great work, but you should set your expectations appropriately -- it's not entirely as seamless, and you will find occasions where the path forward is a bit unclear or requires you to troubleshoot deeper problems.
Again, I think people should remember - OP is not just new to Swift, but new to programming entirely. The bumpiness of the road means it will likely take longer to get things done if you choose Swift -- you might learn more, but it could also be frustrating. It's nice that people are enthusiastic about Swift and excited about future developments that could help these issues, but for somebody learning programming right now (let's say using Windows), there's a high likelihood that you walk away with a negative impression of Swift or of programming overall, which would be unfortunate. So it's better to make it crystal clear that writing a GUI application for Windows using Swift, today, is not an easy path. It's possible, but I wouldn't choose it as my first ever programming project.