Bringing Swift to the Apple ][
2 days ago
- #Swift
- #Apple II
- #Retrocomputing
- SwiftII is a Swift-flavored mini development environment for the Apple II series, designed to bring a subset of Swift to vintage hardware.
- The project uses a bytecode interpreter and virtual machine approach, inspired by Apple Pascal's UCSD p-System, to run Swift-like code on the 6502 CPU.
- SwiftII includes a REPL, file browser, text editor, and compiler, all fitting within the 40,704-byte memory constraint of the Apple II under ProDOS.
- The language supports core Swift features like let/var, if/else, loops, functions, optionals, arrays, and strings, but with limitations such as 16-bit Ints and ASCII strings.
- Memory banking is used to extend functionality, with different disk images for machines like the Apple II Plus, IIe, and those with Saturn 128K or auxiliary RAM upgrades.
- Development involved heavy AI assistance (Claude and Codex) over two months, with phased design documents and testing across multiple emulators and hardware configurations.
- The project emphasizes user experience, with adaptations for pre-IIe keyboard and display limitations, including digraphs and case markers for typing Swift code.
- It ships as nine disk images, catering to different hardware setups and feature sets, with automated testing to ensure compatibility across various Apple II models.
- SwiftII demonstrates the feasibility of porting modern programming language concepts to vintage systems, honoring the legacy of the Apple II and its open architecture.