Khoa Pham
Khoa Pham

Ohayo

Swift Discovery

Discover all the tech

How to present a SwiftUI scene from AppKit

Issue #1053

Plenty of Mac apps still run on an NSApplicationDelegate. The lifecycle works, the windows are wired up, and rewriting everything into the SwiftUI App protocol just to gain one settings window is hard to justify. The friction shows up the …

How does CORS work

Issue #1052

You call an API from your web page and the browser refuses to hand you the response, even though the server replied with a 200. The console shows a message about Access-Control-Allow-Origin. The request left your machine, reached the …

How to setup CORS for AWS API Gateway with Lambda

Issue #1051

You build an API on API Gateway backed by a Lambda, deploy it, then call it from your web app. The request fails before it even returns data:

Access to fetch at 'https://api.example.com/items' from origin …

What's new in Swift 6.4 at WWDC26

Issue #1050

Swift 6.4 arrives with a set of language refinements and standard library additions that make everyday code cleaner and more expressive. This article walks through the most notable changes from WWDC26.

Simplified platform availability …

How to allow domains in WKWebView

Issue #1049

When you embed web content in a WKWebView, you often want it to stay on a set of trusted domains. A login flow that wanders off to an arbitrary site, or a help page that turns into an open browser, is both a security and a product …

What's new in SwiftUI in iOS 27

Issue #1048

WWDC26 covers iOS 27, macOS 27, watchOS 27, tvOS 27, and visionOS 27. It brings new capabilities you can adopt and a couple of behavioral shifts that can break code that compiled fine before. This article starts with the two changes that …

How to export skills from Xcode 27

Issue #1047

Xcode 27 ships with a set of agent skills that capture Apple’s own guidance for writing modern Swift and SwiftUI code. These skills cover things like adopting the newest SwiftUI APIs, modernizing UIKit apps, and auditing security …

How to use Apple signing certificates

Issue #1046

Every app that runs on an Apple device must be signed with a certificate. The signature tells the OS that the code comes from a known developer and hasn’t been tampered with. Xcode manages most of this automatically, but …

How to notarize a Mac app with notarytool

Issue #1045

Distributing a macOS app outside the App Store requires notarization. Apple scans the app for malicious content and attaches a ticket to it so Gatekeeper can verify it offline. Without notarization, users on macOS 10.15 and later see a …

How to follow naming convention in Swift

Issue #1044

Good naming is one of the most underrated forms of documentation. A well-chosen name removes the need for a comment. A poor one forces every reader to mentally re-derive what the code does. Apple’s own frameworks are a rich source …

How to create a toggle control widget in iOS

Issue #1043

iOS 18 introduced interactive controls that live directly in Control Center and on the Lock Screen. Unlike widgets that only display information, control widgets respond to taps, letting users trigger actions without opening the app. A …

How to remove image background in Swift

Issue #1042

Apple’s Vision framework has quietly grown into one of the most capable on-device ML libraries available on Apple platforms. Starting in iOS 17, it gained the ability to separate the foreground subject from the background of a …

How to recognize text in images with Vision in Swift

Issue #1041

The Vision framework has provided text recognition since iOS 13 and macOS 10.15. If you have ever needed to extract text from a screenshot, a photo of a receipt, or a scanned document, this is the tool to reach for. Starting with iOS 18 …

How to use SwiftData

Issue #1040

SwiftData is Apple’s modern persistence framework, introduced in iOS 17. It builds on top of Core Data but exposes a Swift-native API using macros and property wrappers. For most apps targeting iOS 17 or later, it replaces Core Data …

How to use isolated and nonisolated in Swift 6 concurrency

Issue #1039

Actor isolation in Swift 6 is not binary. A type can be mostly isolated while selectively exposing some members to callers from any context. A function can accept any actor and run directly on its executor without being bound to it …

How to use Swift 6 concurrency

Issue #1038

Swift 6 concurrency replaces Grand Central Dispatch queues, locks, and completion handlers with a structured model built around async/await, actors, and task groups. The compiler enforces isolation rules at build time, and the runtime …

How to avoid Swift 6 concurrency crashes

Issue #1037

Enabling Swift 6 strict concurrency checking (SWIFT_STRICT_CONCURRENCY = complete) catches data races at compile time, but it does not protect you fully at runtime. The compiler also injects dynamic isolation assertions at actor and GCD …

How to use closure with Core Data in Swift 6

Issue #1036

Swift 6 makes concurrency safer by enforcing actor isolation at compile time, and sometimes at runtime. One of the subtler rules is that closures automatically inherit the actor isolation of the context where they are defined, not where …

How to use Apple Intelligence as a service

Issue #1035

Apple Intelligence is not just a brand. Since macOS 26 (Tahoe), it ships a developer-accessible framework called Foundation Models that gives your code direct access to the on-device language model powering Writing Tools and Siri. No API …

How to present interactive CLI prompts in Swift

Issue #1034

Swift is a great language for building command-line tools. Package managers, code generators, deployment scripts — they’re all natural fits. But when it comes to collecting input from the user, the standard library leaves you with …

Khoa Pham

Hello, I’m Khoa

I’m a thinker and storyteller with a passion for exploring the intersection of creativity and technology

🧑‍💻 I love crafting high quality and useful apps
🔥 I love open source. My GitHub open source has 2.3k followers with packages that are integrated by 45k+ apps and over 3.4m+ downloads on CocoaPods.
✍️ I write here on my blog and on Medium, which has over 2.7k+ followers with tons of articles and 90k+ monthly views.
🖥 Follow me for sharings about Swift, SwiftUI, iOS and macOS development.
Hei