The Curious Engineer

All blogs / Mobile / iOS / Android

Swift by Sundell

swiftbysundell.com

Weekly Swift articles, podcasts and tips by John Sundell

Mobile / iOS / AndroidSoftware / engineering practice

Posts
533 from 18 Jan 2017 to 30 Oct 2026
Posting
now and then (4 in the last year)
Kind
personal blog
Feed
https://swiftbysundell.com/feed.rss

2026 4

  1. Interesting ways of using Swift optionals
  2. Using Swift’s ‘some’ keyword beyond SwiftUI
  3. Why Swift is introducing a warning for weak captures within nested closures
  4. Swift protocols and the main actor

2025 7

  1. Building a design system at Genius Scan
  2. Deciding between ‘let’ and ‘var’ for Swift struct properties
  3. Decoding Swift types that require additional data
  4. Tips and tricks for when using SwiftUI’s ViewBuilder
  5. Using Swift’s defer keyword within async and throwing contexts
  6. Modern URL construction in Swift
  7. Swift by Sundell is back!

2023 2

  1. SwiftUI views versus modifiers
  2. Observing the content offset of a SwiftUI ScrollView

2022 31

  1. Podcast: “The evolution of Swift”, with special guest Nick Lockwood
  2. Podcast: “Swift concurrency in practice”, with special guest Ben Scheirman
  3. Combining opaque return types with primary associated types
  4. Podcast: “Responsive and smooth UIs”, with special guest Adam Bell
  5. Podcast: “Freelancing and WWDC22 highlights”, with special guest Donny Wals
  6. Podcast: “The role of system design”, with special guest Gui Rambo
  7. Sponsored: Essential Developer
  8. Podcast: “What’s new in SwiftUI in iOS 16?”, with special guest Natalia Panferova
  9. Switching between SwiftUI’s HStack and VStack
  10. Podcast: “Swift 5.7, generics, and the road to Swift 6”, with special guest Ben Cohen
  11. Using the ‘some’ and ‘any’ keywords to reference generic protocols in Swift 5.7
  12. Swift 5.7’s new optional unwrapping syntax
  13. Rendering SwiftUI views within UITableView or UICollectionView cells on iOS 16
  14. Podcast: “The evolution of SwiftUI”, with special guest Chris Eidhof
  15. Swift by Sundell turns five years old today! Here’s what’s next for the website and the podcast
  16. Podcast: “A framework and an app”, with special guest Simon Støvring
  17. Type placeholders in Swift
  18. Podcast: “Accessibility on Apple’s platforms”, with special guest Sommer Panage
  19. Abstract types and methods in Swift
  20. Sponsor: Judo
  21. Basics: Equality
  22. Basics
  23. Podcast: “Where is Swift headed in 2022?”, with special guest JP Simard
  24. Writing testable code when using SwiftUI
  25. Combining protocols in Swift
  26. Memory management when using async/await in Swift
  27. Automatically retrying an asynchronous Swift Task
  28. Backgrounds and overlays in SwiftUI
  29. Basics: Loops
  30. Creating Combine-compatible versions of async/await-based APIs
  31. Two ways of capturing self strongly within a closure

2021 85

  1. Podcast: “The 2021 Season Finale”
  2. Building an asynchronous SwiftUI button
  3. Podcast: “Custom rendering”, with special guest James Thomson
  4. New Discover page: Concurrency
  5. Delaying an asynchronous Swift Task
  6. Lightweight dependency injection and unit testing using async functions
  7. Podcast: “Concurrency beyond app development”, with special guest Tim Condon
  8. What role do Tasks play within Swift’s concurrency system?
  9. Swift actors: How do they work, and what kinds of problems do they solve?
  10. Podcast: “Code maintenance”, with special guest Nick Lockwood
  11. Unit testing Swift code that uses async/await
  12. Using count vs isEmpty to check whether a collection contains any elements
  13. Building async and concurrent versions of forEach and map
  14. Podcast: “Concurrency and Swift-DocC”, with special guest Marin Todorov
  15. Using Swift’s concurrency system to run multiple tasks in parallel
  16. Podcast: “UIKit in 2021”, with special guest Ben Scheirman
  17. Making async system APIs backward compatible
  18. Swift’s new concurrency system gains backward compatibility in Xcode 13.2
  19. New Discover page: Generics
  20. Specialized extensions using generic type constraints
  21. Building editable lists with SwiftUI
  22. Which of the SwiftUI APIs introduced in iOS 15 are backward compatible?
  23. Podcast: “Opportunities for optimization”, with special guest Christian Selig
  24. Programmatic navigation in SwiftUI
  25. Podcast: “Building various kinds of editors”, with special guest Marcin Krzyzanowski
  26. Previewing SwiftUI views in landscape
  27. Using Combine’s share operator to avoid duplicate work
  28. New Discover page: Codable
  29. Codable synthesis for Swift enums
  30. Sponsor: Paste
  31. Conditional compilation within Swift expressions
  32. Podcast: “The magic of Augmented Reality”, with special guest Roxana Jula
  33. Async sequences, streams, and Combine
  34. Podcast: “What’s new in Swift 5.5”, with special guest Antoine van der Lee
  35. Using static protocol APIs to create conforming instances
  36. Defining dynamic colors in Swift
  37. Using ‘@unknown default’ within switch statements
  38. Podcast: “WWDC21, two months later”, with special guest Jordan Morgan
  39. Throwing and asynchronous Swift properties
  40. Attaching property wrappers to function arguments
  41. Podcast: “Cross-platform SwiftUI”, with special guest Malin Sundberg
  42. Stroking and filling a SwiftUI shape at the same time
  43. Mutating and non-mutating Swift contexts
  44. Sponsor: ViRE
  45. Podcast: “A tower of capabilities”, with special guest Chris Lattner
  46. Dismissing a SwiftUI modal or detail view
  47. Optional SwiftUI views
  48. Calling async functions within a Combine pipeline
  49. Making SwiftUI views refreshable
  50. Basics: Availability checks
  51. Customizing how an external Swift type is encoded or decoded
  52. Connecting async/await to other Swift code
  53. Bindable SwiftUI list elements
  54. Automatic conversions between Double and CGFloat values in Swift 5.5
  55. Using the MainActor attribute to automatically dispatch UI updates on the main queue
  56. Podcast: “Structured concurrency”, with special guest Doug Gregor
  57. First looks at the new APIs and frameworks announced at WWDC21 on WWDC by Sundell & Friends
  58. A Swift developer’s WWDC dreams - 2021 edition
  59. Podcast: “An entire spectrum of apps”, with special guest Sean Allen
  60. Avoiding problematic cases when using Swift enums
  61. Avoiding having to recompute values within SwiftUI views
  62. Three ways to render a SwiftUI view in a playground
  63. Assigning an expression to a variable with the same name
  64. Introducing Plot Components: A new way to build HTML pages using Swift
  65. Deciding what DispatchQueue to run a completion handler on
  66. Controlling the timing of a Combine pipeline
  67. Using SwiftUI’s frame modifier to resize and align views
  68. Styling localized strings in Swift
  69. A deep dive into Swift’s result builders
  70. Annotating properties with result builder attributes
  71. Exploring some of the lesser-known, built-in Formatter types
  72. Using Combine’s futures and subjects
  73. Questions
  74. Automatic handling of property wrapper default values
  75. Ignoring invalid JSON elements when using Codable
  76. Unit testing Combine-based Swift code
  77. Chained implicit member expressions in Swift 5.4
  78. Managing self and cancellable references when using Combine
  79. Passing methods as SwiftUI view actions
  80. Applying rounded corners to a UIKit or SwiftUI view
  81. Accessing a Swift property wrapper’s enclosing instance
  82. Avoiding SwiftUI’s AnyView
  83. Validating email addresses using RawRepresentable and NSDataDetector
  84. Performing POST and file upload requests using URLSession
  85. Creating custom query functions using key paths

2020 98

  1. Using multiple computed properties to form a SwiftUI view’s body
  2. Welcome to Swift by Sundell 3.0
  3. 200 weeks of Swift
  4. The lifecycle and semantics of a SwiftUI view
  5. Observing Combine publishers in SwiftUI views
  6. Sorting Swift collections
  7. Statically computed default property values
  8. Extending Combine with convenience APIs
  9. SwiftUI and UIKit interoperability - Part 2
  10. Creating custom SwiftUI container views
  11. SwiftUI and UIKit interoperability - Part 1
  12. Formatting numbers in Swift
  13. Connecting and merging Combine publishers in Swift
  14. The power of extensions in Swift
  15. Publishing constant values using Combine
  16. Handling loading states within SwiftUI views
  17. Lazy property observers
  18. Testing networking logic in Swift
  19. Importing interactive UIKit views into SwiftUI
  20. Encapsulating SwiftUI view styles
  21. Creating generic networking APIs in Swift
  22. Creating closure-based UI controls using UIAction
  23. How Swift 5.3 enhances SwiftUI’s DSL
  24. Building modern collection views in Swift
  25. Showing view controllers, rather than pushing them
  26. Working with files and folders in Swift
  27. Handling view controllers that have custom initializers
  28. Building SwiftUI debugging utilities
  29. Using compiler directives in Swift
  30. How the raw values of Int-based enums get incremented
  31. Multiline string literal tips and tricks
  32. Rendering textured views with SwiftUI
  33. Adding SwiftUI’s ViewBuilder attribute to functions
  34. Building custom Combine publishers in Swift
  35. Generating automatic placeholders for SwiftUI views
  36. Five powerful, yet lesser-known ways to use Swift enums
  37. SwiftUI extensions using generic type constraints
  38. Opaque return types in Swift
  39. Implicit capturing of self in Swift 5.3
  40. Type inference
  41. Using an AppDelegate with the new SwiftUI-based app lifecycle
  42. A guide to SwiftUI’s state management system
  43. Learning SwiftUI by building tools and prototypes
  44. A first look at SwiftUI’s new StateObject property wrapper
  45. A Swift developer’s WWDC dreams - 2020 edition
  46. Organizing default argument values
  47. Useful APIs when writing scripts and tools in Swift
  48. Annotating properties with default decoding values
  49. Handling model variants in Swift
  50. Designing reusable Swift libraries
  51. Quickly replacing singletons with functions
  52. Getting the most out of Xcode Previews for SwiftUI
  53. Properties
  54. Why does Swift by Sundell not use any client-side JavaScript?
  55. Avoiding deeply nested Swift code
  56. Building an Observable type for SwiftUI views
  57. Using test assertion messages as comments
  58. Propagating user-facing errors in Swift
  59. Three years of Swift by Sundell
  60. The different categories of Swift protocols
  61. Inferred generic type constraints
  62. Querying collections in Swift
  63. Enums with custom raw types
  64. Mixing enums with other Swift types
  65. Combine
  66. Published properties in Swift
  67. Combining dynamic member lookup with key paths
  68. Handling keyUp and keyDown events on iOS 13.4 and later
  69. A guide to the SwiftUI layout system - Part 3
  70. Protocols
  71. A guide to the SwiftUI layout system - Part 2
  72. Inline wrapping of UIKit or AppKit views within SwiftUI
  73. Explicit type annotations
  74. A guide to the SwiftUI layout system - Part 1
  75. Making properties overridable only in debug builds
  76. The Result Type
  77. When can a struct’s memberwise initializer be used?
  78. Writing small utility functions in Swift
  79. Working remotely
  80. Avoiding massive SwiftUI views
  81. Using Swift’s built-in randomization APIs
  82. Splitting up Swift types
  83. What makes code “Swifty”?
  84. Using SwiftUI’s ForEach with raw values
  85. Configuring SwiftUI views
  86. Optionals
  87. Exploring Swift 5.2’s new functional features
  88. Passing key paths as functions
  89. Picking between a for loop and forEach
  90. Slicing Swift collections
  91. Swift’s closure capturing mechanics
  92. Result’s convenience APIs
  93. Under the hood of Futures and Promises in Swift
  94. Property wrappers in Swift
  95. Test assertions in Swift
  96. Access Control
  97. Using Self to refer to enclosing types
  98. Writing reusable Swift extensions

2019 104

  1. The Decade of Swift
  2. Initializers in Swift
  3. Maintaining model consistency in Swift
  4. Predicates in Swift
  5. Making Swift code extensible through plugins
  6. Lightweight API design in Swift
  7. Defining custom patterns in Swift
  8. Combining value and reference types in Swift
  9. Enums
  10. Implementing throwing protocol functions as non-throwing
  11. Deciding whether to adopt new Swift technologies
  12. Pragmatic unit testing in Swift
  13. Using key paths in switch statements
  14. Default arguments in Swift
  15. Omitting the return keyword
  16. Encapsulating configuration code in Swift
  17. Alternatives to protocols in Swift
  18. Computing dates in Swift
  19. Making types expressible by string interpolation
  20. Closures
  21. 5 small but significant improvements in Swift 5.1
  22. Gathering test coverage in Xcode
  23. Managing dependencies using the Swift Package Manager
  24. SwiftUI
  25. Reducers in Swift
  26. Limiting collection mutations
  27. Picking the right data structure in Swift
  28. Extracting subsequences
  29. Caching in Swift
  30. Referring to overloaded functions
  31. The power of subscripts in Swift
  32. Switching on multiple values
  33. Computed properties in Swift
  34. Time Complexity
  35. Computed properties vs methods
  36. Phantom types in Swift
  37. Strings
  38. Passing operators as functions
  39. Rule-based logic in Swift
  40. Character category properties
  41. Utilizing value semantics in Swift
  42. Specializing generics with type aliases
  43. Map, FlatMap and CompactMap
  44. Generalizing Swift code
  45. Customizing Codable types in Swift
  46. Default enum associated values
  47. Defining testing data in Swift
  48. The power of variadic parameters
  49. Configurable types
  50. Improved compiler errors for auto-synthesized conformances in Xcode 11
  51. Configurable types in Swift
  52. Improved memberwise initializers in Swift 5.1
  53. Shifting paradigms in Swift
  54. Using SwiftUI in a playground
  55. The Swift 5.1 features that power SwiftUI’s API
  56. Stacking views in SwiftUI
  57. Refactoring SwiftUI views using functions
  58. SwiftUI mix and match
  59. SwiftUI is a game changer
  60. A Swift developer’s WWDC dreams - 2019 edition
  61. Review: Swift Playgrounds 3.0 for iPad
  62. Extracting view controller actions in Swift
  63. Functional networking
  64. Testing custom Codable implementations
  65. Wrapping sequences in Swift
  66. Pure functions in Swift
  67. Structuring model data in Swift
  68. Generics
  69. Property observers in Swift
  70. Refactoring enums which cases contain the same data
  71. Converting between String and Data without optionals
  72. Designing Swift APIs
  73. Combined Swift packages
  74. String literals in Swift
  75. Value and Reference Types
  76. Bindable values in Swift
  77. Swift’s composition operator
  78. Memory Management
  79. Generic algorithms
  80. Different flavors of type erasure in Swift
  81. The ‘final’ keyword
  82. String parsing in Swift
  83. Using key paths to create convenience APIs
  84. Error Handling
  85. Integration tests in Swift
  86. Recursive enums with “fake” cases
  87. The power of UserDefaults in Swift
  88. Pattern matching in Swift
  89. The flexible syntax of enums
  90. Inline types and functions in Swift
  91. Grouping throwing expressions using tuples
  92. Animations
  93. Reflection in Swift
  94. Task-based concurrency in Swift
  95. Testing error code paths in Swift
  96. The power of type aliases in Swift
  97. Codable
  98. Networking
  99. Sharing Swift code
  100. Unit Testing
  101. Child View Controllers
  102. Grand Central Dispatch
  103. Layout Anchors
  104. Functional networking in Swift

2018 106

  1. Wrapping up 2018 on Swift by Sundell
  2. Swift playgrounds tips and tricks
  3. Slot-based UI development in Swift
  4. Using property observers
  5. Using errors as control flow in Swift
  6. Checking whether an element was inserted into a set
  7. Mock-free unit tests in Swift
  8. Managing objects using Locks and Keys in Swift
  9. Extending optionals in Swift
  10. Making async tests faster and more stable
  11. Building iPad Pro features in Swift
  12. Adding support for Apple Pencil double-taps
  13. Avoiding race conditions in Swift
  14. The power of key paths in Swift
  15. Combining values with functions
  16. Dependency injection using functions
  17. Specializing protocols in Swift
  18. Using a custom exception handler
  19. Using type aliases to give semantic meaning to primitives
  20. Building DSLs in Swift
  21. Specializing protocols using constraints
  22. Constructing URLs in Swift
  23. Unwrapping an optional or throwing an error
  24. Different flavors of view models in Swift
  25. Testing code that uses static APIs
  26. Async/await in Swift unit tests
  27. Reusable data sources in Swift
  28. Matching multiple enum cases with associated values
  29. Lightweight presenters in Swift
  30. Early returning functions in Swift
  31. Multiline string literals don’t require quotes to be escaped
  32. Enum iterations in Swift
  33. Model controllers in Swift
  34. Reducing sequences
  35. Avoiding manual Codable implementations
  36. Trimming long argument lists in Swift
  37. Type inference-powered serialization in Swift
  38. Structuring Swift code
  39. Writing backward compatible Swift code
  40. Using feature flags instead of feature branches
  41. Lightweight data hierarchies using tuples
  42. Refactoring Swift code for testability
  43. Subclass-free view controllers in Swift
  44. Custom container view controllers in Swift
  45. The rule of threes
  46. Handling mutable models in Swift
  47. The power of Result types in Swift
  48. Making Swift tests easier to debug
  49. Faster & more robust tests with Xcode 10
  50. Getting started with signposts
  51. Useful Codable extensions
  52. Synthesized conditional conformances in Swift 4.2
  53. A more Swifty Core Animation
  54. A first look at the Natural Language framework
  55. Static factory methods in Swift
  56. Using shared UserDefaults suites
  57. Writing self-documenting Swift code
  58. Custom UIView backing layers
  59. Auto-Equatable enums with associated values
  60. Launch arguments in Swift
  61. Defaults for associated types
  62. Type-safe identifiers in Swift
  63. Creating a dedicated identifier type
  64. Logic controllers in Swift
  65. Assigning optional tuple members to variables
  66. Delegation in Swift
  67. Struct convenience initializers
  68. Usages of throwing functions
  69. Observers in Swift - Part 2
  70. Observers in Swift - Part 1
  71. Nested generic types
  72. Using the builder pattern in Swift
  73. Equatable and Hashable structures
  74. Conditional conformances in Swift
  75. Conditional conformances
  76. Generic type aliases
  77. Feature flags in Swift
  78. Preventing views from being model aware in Swift
  79. Parsing command line arguments using UserDefaults
  80. Using tuples as lightweight types in Swift
  81. Capturing multiple values in mocks
  82. The power of sets in Swift
  83. Code encapsulation in Swift
  84. Reducing the need for mocks
  85. Using "then" as an external parameter label for closures
  86. Navigation in Swift
  87. Combining lazily evaluated sequences with the builder pattern
  88. Unit testing asynchronous Swift code
  89. Faster and more stable UI tests
  90. Custom operators in Swift
  91. Accessing the clipboard from a Swift script
  92. Composing types in Swift
  93. Throwing tests and LocalizedError
  94. The difference between static and class properties
  95. Creating extensions with static factory methods
  96. Transforming collections in Swift
  97. Child view controller auto-resizing
  98. Using zip
  99. Mocking in Swift
  100. Defining custom option sets
  101. Using the where clause with associated types
  102. Using first class functions when iterating over a dictionary
  103. First class functions in Swift
  104. Calling instance methods as static functions
  105. Dropping suffixes from method names to support multiple arguments
  106. Constraining protocols to classes to ensure mutability

2017 96

  1. Wrapping up 2017 on Swift by Sundell
  2. Goals
  3. String-based enums in string interpolation
  4. Separation of concerns using protocols in Swift
  5. Expressively comparing a value with a list of candidates
  6. UIView bounds and transforms
  7. Different flavors of dependency injection in Swift
  8. UIKit default arguments
  9. UI testing analytics code in Swift
  10. Avoiding Massive View Controllers
  11. Extending optionals
  12. Building an enum-based analytics system in Swift
  13. Using where with for-loops
  14. Using unit tests to identify and avoid memory leaks in Swift
  15. Using child view controllers as plugins in Swift
  16. Variable shadowing
  17. Using dot syntax for static properties and initializers
  18. Calling functions as closures with a tuple as parameters
  19. Avoiding force unwrapping in Swift unit tests
  20. Productivity
  21. Enabling static dependency injection
  22. Dependency injection using factories in Swift
  23. Type inference for lazy properties in Swift
  24. Using tokens to handle async Swift code
  25. Converting Swift errors to NSError
  26. Capturing objects in Swift closures
  27. Open sourcing Swift code
  28. Avoiding singletons in Swift
  29. Making UIImage macOS compatible
  30. Using generic type constraints in Swift
  31. Internally mutable protocol-oriented APIs
  32. The power of switch statements in Swift
  33. Creating custom collections in Swift
  34. Under the hood of Assertions in Swift
  35. Switching on a set
  36. Using the factory pattern to avoid shared state in Swift
  37. Core Animation gems: Using replicator layers in Swift
  38. Adding the current locale to cache keys
  39. Setting up tests to avoid retain cycles with weak references
  40. Replacing legacy code using Swift protocols
  41. Organizing code using extensions
  42. Using map to transform an optional into a Result type
  43. Assigning to self in struct initializers
  44. Recursively calling closures as inline functions
  45. Reducing flakiness in Swift tests
  46. Passing self to required Objective-C dependencies
  47. Building a declarative animation framework in Swift - Part 2
  48. Making weak or lazy properties readonly
  49. Building a declarative animation framework in Swift - Part 1
  50. Defining static URLs using string literals
  51. Identifying objects in Swift
  52. Manipulating points, sizes and frames using math operators
  53. Using closure types in generic constraints
  54. Writing end-to-end JSON mapping tests in Swift
  55. Modelling state in Swift
  56. Using associated enum values to avoid state-specific optionals
  57. Using SpriteKit to create animations in Swift
  58. Using enums for async result types
  59. Writing unit tests in Swift playgrounds
  60. Working on async code in a playground
  61. Overriding self with a weak reference
  62. Exploring the new String API in Swift 4
  63. A deep dive into Grand Central Dispatch in Swift
  64. Using DispatchWorkItem
  65. Using @autoclosure when designing Swift APIs
  66. Getting started with Xcode UI testing in Swift
  67. Combining a sequence of functions
  68. Chaining optionals with map and flatMap
  69. Using lazy properties in Swift
  70. Using self-executing closures for lazy properties
  71. Adding Continuous Integration to a Swift project
  72. Picking the right way of failing in Swift
  73. Time traveling in Swift unit tests
  74. Avoiding mocking UserDefaults
  75. Using variadic parameters
  76. Building a command line tool using the Swift Package Manager
  77. Handling non-optional optionals in Swift
  78. Referring to enum cases with associated values as closures
  79. Namespacing Swift code with nested types
  80. Comparing objects by instance
  81. Calling initializers with dot syntax and passing them as closures
  82. Testing Swift code that uses system singletons in 3 easy steps
  83. Structuring UI tests as extensions on XCUIApplication
  84. Avoiding default cases in switch statements
  85. Using the guard statement in different scopes
  86. Simple Swift dependency injection with functions
  87. Using #function for UserDefaults key consistency
  88. Improving Swift compile times
  89. Using a name already taken by the standard library
  90. Swift sequences: The art of being lazy
  91. Type erasure using closures in Swift
  92. Providing a unified Swift error API
  93. Using typealiases to reduce the length of method signatures
  94. Referencing either external or internal parameter names when writing docs
  95. Using auto closures
  96. Namespacing with nested types