Apple Latest Tech: New Swift, Xcode, MacBook Air and More
- #Swift
- #Xcode
• 5 min read
Protocols will never be the same with the latest Swift update? Should you stop using KeyPath? Meet the new MacBook Air and Swift for embedded systems. Subscribe to our blog and stay tuned for major news from iOS and macOS development.
I'm Roman Mishchenko, an engineer in the CleanMyMac team, and let's dive in!
Mise - a new version manager for Tuist
We've recently told you about the launch of Tuist 4. With this release, the project deprecated tuistenv
as a version manager and transitioned to mise
.
Written in Rust, Mise is a new version manager tool that deserves your attention. It reminds me of pyenv
, nvm
, or asdf
, but it's not limited to just one programming language. It can handle multiple versions of tools and automatically switch to the appropriate one when you navigate to a folder in your terminal. This magic happens thanks to a .tools-version file located within the directory.
On top of that, Mise can manage environment variables, allowing you to specify configurations like ACCESS_KEY_ID
, which may vary across projects.
Discover more at https://mise.jdx.dev/.
New releases from Apple
Swift 5.10
On March 5th, Apple released a new version of Swift - version 5.10. The update focused on ensuring Data-race safety, and also fixed numerous bugs in Sendable and Actor checking to strengthen the guarantees of complete concurrency checking.
Apart from that, Swift now finally supports nested protocols! This means you can create protocols that are part of struct/class/enum/actor, or even a function. It opens up new and exciting possibilities for us as developers. As a bonus, delegate names can now be much shorter, making the structure of your code simpler.
Xcode 15.3
Along with the new Swift version, Apple also released the new Xcode 15.3, which comes with several interesting changes:
- Improved SwiftUI preview, making it less likely to fail and adding the ability to take screenshots of the previews.
- Xcode will now alert you if any global or static variable needs to be either isolated from the global actor or made both immutable and of type Sendable.
- Updated standard C++ library with new features and higher performance.
MacBook Air M3
On the hardware side, Apple has also unveiled the new MacBook Air. This time, they decided to skip the big presentation and opted for a press release. The new Air features the latest M3 chip but retains its previous design. It comes with an upgraded Wi-Fi 6E module. Voice isolation support has been added, which should enhance the clarity for audio and video calls, making Zoom calls even better.
Interestingly, Apple also updated the SSD, which now consists of two NAND chips. This not only boosts the SSD speed but could also improve swap memory performance when the RAM is fully used.
The base model continues to offer 8GB of unified memory and 256GB of storage. Its starting price remains unchanged, at $1,099 for the 13-inch model and $1,299 for the 15-inch model. Meanwhile, Apple has kept the Air with the M2 processor on sale but lowered its price by $100. However, the Air models with the M1 chip have been discontinued, meaning all current MacBooks have now transitioned to a new design with a notch.
What’s wrong with Swift
Swift still has a bunch of unresolved issues. Let me explain. At Swift forum, developers are discussing challenges creating back-end solutions on Linux using Swift. Interestingly, they pointed out
- The absence of dynamic libraries for Linux that support library evolution;
- The lack of a library archive as a type of artifact for SPM;
- Increased build times on Linux, and delays in Swift updates (like the ability to use macros).
There is also a familiar issues most developers face with SPM caches or Derived Data, where you might have to completely clear them because Xcode can't find a certain library. Maybe someday, Apple will manage to solve this problem.
KeyPath performance concerns
An important detail: the article mentions the KeyPath performance issue in Swift. Actually, this problem isn't new, and benchmarks found on GitHub from as far back as 2018 show that using KeyPath can significantly reduce code performance, by many times over. We decided to test it ourselves and found performance drops of 5 to 10 times compared to direct access. This is much better than it was five years ago, but there's still need for improvement. So, be careful when using KeyPath in your code.
Swift for embedded
A new article appeared on Swift.org about coding for Playdate. Playdate is a small handheld gaming system created by Panic. It's equipped with a Cortex M7 processor, a 1-bit display with 400 by 240 pixels, and has a small runtime for hosting games. Because of this, most Playdate games are written in C and Lua.
How does it relate to Swift.org?
The thing is, for some time now, Swift has been developing a new embedded language mode to support embedded platforms. This mode uses additional language restrictions to create tiny binary files while still retaining the core features of the language.
The author ported a test project to Swift and found that the game's binary file in Swift was 13% smaller than in C, that's 116 bytes less. It's important to note that neither version of the project was optimized, but Swift results are still impressive.
The author also described in detail the development path for Playdate: from simulator to actual device. For now, all the work is available for download. So, you can also try Swift in an unusual format.