RSSAmplifier

Blog

Cocoa with Love

Recent content on Cocoa with Love

cocoawithlove.comRSS feed ↗8 posts

Latest posts

Training an LLM in Swift, Part 2: macOS built-in frameworks

In this article, I’m going to look at some of the frameworks that are built into macOS for numerical algorithms. Fitting with the theme of this series, I’ll mostly be looking at frameworks that can also train an ML model. But there’s a lot of different approaches – Accelerate (BLAS), BNNS, CoreML, MPSGraph – and the real challenge is knowing which one to use – if they are even…

Training an LLM in Swift, Part 1: Taking matrix multiplication from Gflop/s to Tflop/s

In this article, I try to get my own handwritten matrix multiplication code running as fast as possible for training a Large Language Model (LLM) in Swift. The aim is to give some insight into the key steps for optimizing mathematics code in Swift. I also hope that these examples will offer a sense of scale about the capabilities of the different units on Apple Silicon – CPU, SIMD, AMX and GPU.…

Have LLMs improved for Swift coding in the last 12 months?

In the previous article , I struggled through getting GitHub Copilot (at the time based on GPT 4o) to generate a small Swift/SwiftUI/AVFoundation application. The app was about 400 lines long but Copilot struggled to handle more than a hundred lines or so at a time. Essentially every line in the app required manual rewriting. Twelve months later, I wanted to check back in to see if it is finally…

Using Copilot to write a raindrop audio synthesizer using AVAudioEngine

I’ve largely ignored the use of large language models (LLMs) as programming assistants, despite (or because of) the hype of the last 2 years. I’ve had a preconception that an LLM might not work well enough or might not meet my expectations of code quality. Since Microsoft have recently made the lowest tier of GitHub Copilot for VS Code free , I wanted to test that preconception and see…

App architecture basics in SwiftUI Part 4: Services

This article is about adding a separated Services-layer to an app. A Services-layer is, in my opinion, the single best app architectural addition you can make, after the basic Model-View separation already implicit in SwiftUI. Model-View separation decouples the Model from the front-end but a Services-layer completes Model separation by separating the Model from the back-end and is one of the few…

App architecture basics in SwiftUI Part 3: Module-separated layers

In the previous article , I looked at how SwiftUI’s data-driven changes force a basic separation between Model and View. The separation is limited in scope, requiring only that there exist a state value or observable object that drives view updates. If a cleaner separation between Model and View is desired, then slicing an app into modules (Swift’s name for discrete libraries) is the…

App architecture basics in SwiftUI, Part 2: SwiftUI's natural pattern

In the previous article , I wrote a simple SwiftUI app. During the writing, I deliberately kept the code simple – writing code only when needed to satisfy user-facing goals. I want to take a closer look at the application architecture that naturally emerges in SwiftUI when following this kind of functionally minimalist approach. Perform a web search for “SwiftUI pattern” and…

App architecture basics in SwiftUI, Part 1: Coding through iteration and integration

In this series of articles, I’ll look at fundamental app architectural concepts and how they apply to an app written in SwiftUI. To begin the series, I want to start with something small: a JSON feed reader app in SwiftUI. I want to focus on the order of the steps, not the code itself and answer a common question: which should you write first, View-code or Model-code? The short answer is…