# Atoms

Atoms is a powerful and flexible atomic state management library for Swift, designed to create compact, independent global state components with seamless adaptability and composition.

# The evolution of Facebook’s iOS app architecture

After years of iteration, the Facebook codebase does not resemble a typical iOS codebase:

  • It’s full of C++, Objective-C(++), and Swift.
  • It has dozens of dynamically loaded libraries (dylibs), and so many classes that they can’t be loaded into Xcode at once.
  • There is almost zero raw usage of Apple’s SDK — everything has been wrapped or replaced by an in-house abstraction.
  • The app makes heavy use of code generation, spurred by Buck, our custom build system.
  • Without heavy caching from our build system, engineers would have to spend an entire workday waiting for the app to build.
  • FBiOS was never intentionally architected this way. The app’s codebase reflects 10 years of evolution, spurred by technical decisions necessary to support the growing number of engineers working on the app, its stability, and, above all, the user experience.

It must be either brilliant to work on or an absolute pain.

# 30,000 lines of SwiftUI in production later: We love it but you know there was going to be a “but”

It took a few hours to fall in love with SwiftUI. So much so that we instantly decided to abandon a cross-platform codebase and go fully native on iOS. timing.is shipped this month on the App Store. It was built entirely in SwiftUI. Its development took several months. It would have been less if SwiftUI just gave. Unfortunately, repeatedly it would take.

Can confirm: SwiftUI is nice and easy in when it works, but in general, it’s a giant pain. It’s embarrassing for Apple to release a framework in such a half-baked state.

It was fun at least 51% of the time. But let’s talk about the <= 49% that wasn’t.

Imagine writing lots of code that works well, and then getting stuck for a few days on a tiny thing that just doesn’t want to work. That’s SwiftUI experience.

# Stable Diffusion with Core ML on Apple Silicon

Today, we are excited to release optimizations to Core ML for Stable Diffusion in macOS 13.1 and iOS 16.2, along with code to get started with deploying to Apple Silicon devices.

The repository contains Python and Swift packages. With the latter, you can add Stable Diffusion functionality to your iOS/Mac apps.

Users report that 50 iterations to generate an image that previously took about 3 minutes now take 30 seconds on M1 Macs.