Building a design system at Genius Scan
As an app’s code base grows and evolves, it can be really tricky to maintain consistency within its UI. It’s easy for things like margins and padding, or colors and fonts, to start diverging, as...
View ArticleDeciding between ‘let’ and ‘var’ for Swift struct properties
When declaring a Swift property, we use either the let or var keyword depending on whether we want our new property to be read-only once assigned through the enclosing type’s initializer, or whether we...
View ArticleDecoding Swift types that require additional data
Swift’s Codable API — which consists of the Encodable protocol for encoding, and Decodable for decoding — offers a powerful, built-in mechanism for converting native Swift types to and from a...
View ArticleTips and tricks for when using SwiftUI’s ViewBuilder
SwiftUI’s ViewBuilder type is a key part of the library’s overall API design, in that it’s what enables multiple view expressions to be declared within a given scope (such as a body property...
View ArticleUsing Swift’s defer keyword within async and throwing contexts
Swift’s defer keyword allows us to delay the execution of a given block of code until the current scope is exited. While that might initially not seem that useful (after all, can’t we simply write that...
View ArticleModern URL construction in Swift
These days, most applications need to work with URLs in some form. Perhaps they’re used to make network calls, to read and write files, or to perform various kinds of database operations. In Swift,...
View ArticleSwift by Sundell is back!
I never actually decided to stop writing Swift articles. It just sort of happened. In fact, for the past two years as this website has been very much dormant, I’ve lost count of the number of times...
View ArticleSwiftUI views versus modifiers
One of the most interesting aspects of SwiftUI, at least from an architectural perspective, is how it essentially treats views as data. After all, a SwiftUI view isn’t a direct representation of the...
View ArticleObserving the content offset of a SwiftUI ScrollView
When building various kinds of scrollable UIs, it’s very common to want to observe the current scroll position (or content offset, as UIScrollView calls it) in order to trigger layout changes, load...
View ArticlePodcast: “The evolution of Swift”, with special guest Nick Lockwood
On this final episode of 2022, Nick Lockwood returns to the show to discuss the overall evolution of Swift and its ecosystem of tools and libraries. How has Swift changed since its original...
View ArticlePodcast: “Swift concurrency in practice”, with special guest Ben Scheirman
Ben Scheirman returns to the show to discuss how Swift’s built-in concurrency features, such as async/await and tasks, can be used in practice when building apps for Apple’s platforms.SponsorsEssential...
View ArticleCombining opaque return types with primary associated types
Ever since Swift was first introduced, it’s been very common to need to use type erasure when working with generic protocols — ones that either reference Self within their requirements, or make use of...
View ArticlePodcast: “Responsive and smooth UIs”, with special guest Adam Bell
Adam Bell returns to the podcast to discuss different techniques and approaches for optimizing UI code, and how to utilize tools like animations in order to build iOS apps that feel fast and...
View ArticlePodcast: “Freelancing and WWDC22 highlights”, with special guest Donny Wals
Donny Wals returns to the show to talk about being an iOS developer freelancer, and to discuss some of the key new APIs, Swift language features, and frameworks that were introduced at...
View ArticlePodcast: “The role of system design”, with special guest Gui Rambo
Gui Rambo returns to the show to talk about the role and importance of system design when building apps and open source tools, and how common app architectures and design patterns can be augmented with...
View ArticleSponsored: Essential Developer
Thanks a lot to Caio and Mike, the two developers behind Essential Developer, for sponsoring Swift by Sundell. Essential Developer was founded to help iOS developers accelerate their journeys towards...
View ArticlePodcast: “What’s new in SwiftUI in iOS 16?”, with special guest Natalia...
Natalia Panferova joins John to discuss some of the key new features that are coming to SwiftUI and UIKit in iOS 16, and to talk about her experience working on SwiftUI at Apple.SponsorsNordVPN: Get an...
View ArticleSwitching between SwiftUI’s HStack and VStack
SwiftUI’s various stacks are some of the framework’s most fundamental layout tools, and enable us to define groups of views that are aligned either horizontally, vertically, or stacked in terms of...
View ArticlePodcast: “Swift 5.7, generics, and the road to Swift 6”, with special guest...
Ben Cohen, manager of the Swift team at Apple, joins John on this WWDC22 special to discuss Swift 5.7, how generics have been made more powerful and easy to use, and how the language is expected to...
View ArticleUsing the ‘some’ and ‘any’ keywords to reference generic protocols in Swift 5.7
Combining Swift’s flexible generics system with protocol-oriented programming can often lead to some really powerful implementations, all while minimizing code duplication and enabling us to establish...
View Article