Embedded Swift on the Raspberry Pi Pico
Swift’s growing reach beyond Apple platforms is drawing renewed interest, from running on microcontrollers like the Raspberry Pi Pico to powering Windows apps and server-side code. Commenters praise its enums with associated values, pattern matching, and structured concurrency, often comparing them favorably to Dart, Kotlin, Rust, and .NET, but note trade‑offs around null handling, syntax complexity, and copy‑on‑write semantics. Many see Swift as technically strong yet held back by tooling gaps and a relatively thin ecosystem on non-Apple platforms, especially for UI and large-scale adoption.
Swift language features and enums / pattern matching
- Many commenters praise Swift’s enums with associated values (sum types) and exhaustive switching as simple but powerful.
- These are compared to classic “tagged unions” / discriminated unions from ML, OCaml, F#, etc.; some argue Swift is essentially rediscovering long‑standing ideas.
- Some feel other mainstream languages (especially older ones like Python, Java, C# historically) are late to adopt these constructs or add weaker variants.
Nullability, optionals, and type narrowing
- Big subthread on Swift’s
if let/guard letversus Dart/TypeScript‑style flow‑based null analysis. - Pro‑Swift side: separate binding syntax avoids misuse like “check then force‑unwrap,” makes future refactors safer, and encourages explicit, readable “happy path” code.
- Pro‑Dart/TS side: control‑flow type promotion is simpler and less verbose; using the same
if x != nullthat developers already expect feels more natural. - Some see pervasive optionals as a “new color” of function, potentially overused and propagating uncertainty through code.
Comparisons to other languages
- Kotlin enums are seen as more limited than Swift’s; Kotlin sealed classes are closer but more verbose.
- Dart 3 gains patterns, sealed classes, exhaustiveness; some say it’s converging on Swift‑like features but with more ceremony.
- ML/F#/OCaml are repeatedly cited as prior art for pattern matching and unions.
- Swift is described as sitting between Rust and C++ in ergonomics, with strong types, structured concurrency, and ARCs vs Rust’s borrow checker.
Swift beyond Apple platforms
- Experiences on Linux and Raspberry Pi are generally positive for non‑GUI tools and servers; some report smooth use with frameworks like Vapor.
- Windows and Android support exist but are described as rough or niche; debugging and ecosystem gaps remain.
- Embedded Swift (e.g., Raspberry Pi Pico, Zephyr) benefits from C/C++ interop and CMake integration; still early but promising.
Ecosystem, UI, and viability
- Strong concern that Swift is tightly coupled to Apple’s UI stacks; on other platforms, lack of a first‑class UI framework and small library ecosystem are seen as major barriers.
- Some argue a language is only as useful as its ecosystem; even though Swift is open source, long‑term non‑Apple stewardship is uncertain.
Tooling and developer experience
- Opinions on Xcode and Swift tooling diverge sharply: some report stability and good productivity, others describe frequent crashes and a frustrating experience.
- VS Code and LSP support are improving but not on par with Xcode; .NET and Java ecosystems are held up as more mature for cross‑platform work.