Iterating Over a Generic Sequence in Swift

Here's a goofy bit of generic programming I do all the time in Swift—ironically, it's one thing C++ makes easier than Swift! The use case is simple: I want a function to be able to accept a container (really a Swift Sequence) of any type, as long as its values are of the right type. … Continue reading Iterating Over a Generic Sequence in Swift

Missing SwiftUI Preview Window in Xcode

This is no doubt obvious if you've dutifully watched all the WWDC sessions on SwiftUI, but if you're like me and just diving in and hacking the hell out of it, you might be baffled that the much-renowned preview pane isn't showing up when you create your SwiftUI View. There are two things you need: … Continue reading Missing SwiftUI Preview Window in Xcode

Creating a SwiftUI Window in an Objective-C AppKit App

I've been "rehabbing" a legacy Objective-C app (the Unbound photo browser), trying to make up for a couple years of neglect, and I wanted to start building new views in SwiftUI. There are a lot of good tutorials online for hosting SwiftUI views in UIKit apps (either iOS/iPadOs or macOS + Catalyst), but not much … Continue reading Creating a SwiftUI Window in an Objective-C AppKit App