Direct answer
You can learn the language, but not how to build iOS apps. Swift officially provides toolchains for Windows and Linux; Xcode, SwiftUI previews and the iOS Simulator are macOS only.
Basis
- The swift.org install page states that on Windows you can install with WinGet or an installer package, with specified Visual Studio components needed beforehand, and that on Linux the recommended route is the official Swiftly installer, which manages Swift versions and dependencies. Both have official container images. Go by the swift.org install page for the steps.
- For an editor, swift.org recommends Visual Studio Code with the official Swift extension, which provides code completion, debugging and testing support. Create a project with
swift package initand run it withswift run, and you can complete every language-level exercise: variables, functions, structs, protocols, generics and concurrency. - Where it stops: SwiftUI and UIKit are frameworks for Apple platforms, Xcode exists only for macOS, and the iOS Simulator is part of Xcode. In other words, as soon as a course moves on to "build an iOS app with an interface", this route has reached its end.
- On installing macOS on a non-Apple computer or in a virtual machine: Apple's macOS software license agreement explicitly says it may not be installed, used or run on a computer that is not Apple-branded; the terms are on the Apple software license page. Besides breaching the license, such setups are also unstable when it comes to drivers and system updates, and we do not recommend them.
Boundaries: when the answer is different
If you are learning Swift to write server-side code or command-line tools rather than iOS apps, Windows or Linux is enough: you do not need a Mac at all, and you do not need to rent our machine. Some libraries aimed at Apple platforms are unavailable or behave differently on other systems; go by each library's documentation.
How to do it
- Install the toolchain following the swift.org install page, and run
swift --versionin a terminal to confirm it works. - Install Visual Studio Code and the Swift extension.
- Follow the free official language tutorial on swift.org and work through the language basics.
- Write one or two small command-line programs with the Swift Package Manager to reinforce them.
- When you are ready to start on interfaces and iOS apps, then decide between an iPad, renting a remote Mac, or buying one.
Related questions
- Learn Swift and Xcode without a Mac? Rent to try it or take a course; buy if it's for years
- How far can I get learning Swift with only an iPad and Swift Playgrounds?
- Can I finish a beginner Swift course on a rented Mac without owning one?
- Learning Swift: rent a remote Mac or buy a used Mac?
- How do I publish an app to the App Store without a Mac?
Use case
This question belongs to the use case: Learn Swift and Xcode without a Mac? Rent to try it or take a course; buy if it's for years
Other questions in the same use case:
- Renting a Mac for a Swift course: which rental term should I pick?
- I'm on a monthly plan and want to stop after a few days. Can I get a refund?
- Customer console login fails or the reset email never arrives: what to do
- Payment went through but no machine yet. Is that normal?
Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support