Posts tagged “swift”
2026
Swift Blog Carnival Roundup: Tiny Languages
Recap of the very first Swift Blog Carnival on the topic of Tiny Languages: six posts on task runners, DSLs, parsers, symbolic math, and grammar tools.
Swift Blog Carnival: Tiny Languages
The Swift Blog Carnival topic for April is open; it is about Tiny Languages. Read what a blog carnival is, why you should care, and how to participate!
Zettelkasten for Programmers: Documenting Confusing with Swift.SendableMetatype
I got terribly confused reading the API docs on th SendableMetatype protocol. Because I do not yet know the solution, I want to share how I store this in my Zettelkasten for future problem-solving and discussions.
Use clang API notes to Annotate C Header Files for Swifty Module Imports
Doug Gregor shows how to use clang to import a C library with header files that you don’t own in a way that produces very ergonomic Swift APIs with annotations in YAML files.
2025
Clickable Swift Testing Failure Messages in Emacs compile-mode
The swift test command-line invokation does not print unambiguous filenames for test failures, so we need to attempt to patch this from the console output ourselves like true hackers.
Getting Over Frustratingly New Topics (Swift Concurrency) with a Zettelkasten
I am learning to speak a new language: Swift Concurrency. It is densely packed with familiar-sounding concepts and details I am not aware of (yet). This is how I tackle it.
Variadic Types in Swift and How to Count Them
Exploring parameter packs (the repeat-each stuff) in Swift to count how many types are in the generic argument clause, or if that’s empty.
Calling Swift Library Functions from C
A quick recipe on how to emit a binary from Swift that you can use from a C program.
The Limits of swift-markdown Customization
So I’ve tried to create a processing pipeline with the Markdown package published by the Swift Team. It does a couple of really nice things, but it is also very locked-down in its functionality.
Working with Process Pipe and Its 64KiB Limit
Piping data from your Swift program to another program, or receiving large amounts of data from standard input, can be prone to errors, freezing your program. Here is how to do it safely.
2024
Alex Ozun: Type-Driven Design with Swift (SwiftCraft 2024)
The talk “Type-Driven Design with Swift” by Alex Ozun covers interesting topics and presents type-based solutions to software development problems in an easy-to-grasp way.
Typed Filters and callAsFunction
Combining three Swift features for the sake of expressivitiy: sum types aka enums, callAsFunction to introduce “callable” semantics, and type extensions to beautify call sites.
Negate KeyPath<T, Bool> Values with not()
Here is a simple free function to invert boolean values for all you Swift KeyPath fans out there.
2023
UserDefaults.register(defaults:) Is a Bit Like Nil-Coalescing
Mental model: registering fallback values for UserDefaults is like Optional coalescing in Swift.
The Missing Array.appending(contentsOf:)
There is no immutable append variant to concatenate two Arrays, or Strings, or other collections in the Swift standard library. Here is one.
Swift Pattern Matching with Extra Conditions, and the Value of Syntax Summaries
Natalia Panferova of nilcoalescing.com posted “Swift enum pattern matching with extra conditions”: I believe there’s value in reviewing summaries like these for advanced Swift programmers!
2022
Mutating Struct and State Observers: How the Latter Will Be Notified Even for 'No-Ops'
2021
Swift Pattern Matching Operator: Compiler Error when Specifying Enum Type and Case Name?
The Beauty of Hacking Swift: Make Union of Set Algebra Types More Obvious
XCTestExpectation via NSPredicate Is On a Slow Interval, Use This Instead
2020
Demonstrate Swift's Lazy Initialization of Static Attributes Even when Using a Property Wrapper
Swift API Docs for String.index(_:offsetBy:limitedBy:) Is Still Misleading
2019
2018
How to Fix fileReferenceURL() to Work with NSURL in Swift 3 and Swift 4
2017
Exposing the MultiMarkdown 6 Library to Swift, Part 1: Swifty Enums
Dependency Injection via the Recent "Cake Pattern in Swift" Pattern is Useless in Practice
Core Data is Invasive. You Can Hide It, Or You Can Embrace It
2016
Resolving NSTreeController's "Ambiguous use of 'children'" in Swift 3
Swift 2.3 NSLocale UIKit API Changes Break iOS 8 Compatibility
Creating a Cheap Protocol-Oriented Copy of SequenceType (with a Twist!)
I'll be writing a Word Counter Swift module fully East-Oriented
2015
Optional Protocol Methods in Swift using Closures and No Protocol, Actually
Put Usage of a CoreDataFetchRequest out of Your Code and Into ... Where Exactly?
Swift Protocol Extensions as Mixins – And How Do You Test That?
Testing Shorthand: Use a Subclass of the Real Object Under Test
Save Yourself Casting Headaches with a Generic Fetch Request Object
Refactoring Legacy Code: Replace Free Function in Tests, Even Swift's Own Functions
Protocol Madness: Comparing Apples to Oranges from the Vantage Point of Fruit
How to Write Unit Tests for Storyboard-based Buttons in Swift
Test doubles for Core Data managed objects might not work as expected
Thinking in Terms of Functional Programming Encourages Clean Factoring of Code