• Coming Soon on App Store
  • Home
  • Contents
    • Articles
    • Videos
  • Channels

Nav Menu

  • Home
  • Articles
  • Videos
  • Channels

Copyright By SoftSky App LTD - 2025

  • Contact Us
  • Terms of Use
  • Privacy Policy

Swift by Sundell, created and run by John Sundell since 2017, shares free articles, tips, podcasts, and videos on Swift, iOS, and Mac development for all skill levels. John is a passionate developer and designer, freelances in iOS/Mac development, and co-hosts the Stacktrace podcast.

RSShttps://swiftbysundell.com/rss
  • intermediate
  • By Swift By Sundell
  • Aug 31

Building a design system at Genius Scan

An incremental SwiftUI design system via composition: start with a generic Row, compose TextFieldRow and a reusable TextInputView that selects TextField/SecureField using UITextContentType and @FocusState. Evaluate ViewBuilder closures in init. Use environment-driven config (RowStyle, colors) via View modifiers.

  • intermediate
  • By Swift By Sundell
  • Jul 23

Deciding between ‘let’ and ‘var’ for Swift struct properties

How let vs var on structs impact memberwise init, default values, and Codable: let optionals need explicit args; let with defaults can’t be overridden/decoded. Use a custom init or a Readonly property wrapper (Codable). inout shows mutability. Prefer vars; keep stable IDs let.

  • intermediate
  • By Swift By Sundell
  • Jun 30

Decoding Swift types that require additional data

Shows how to decode Swift models that need data not present in the payload. Instead of optional fields or a Partial type, use DecodableWithConfiguration to inject required values. Adds a JSONDecoder shim using userInfo for iOS 15–16. Example uses URLSession, async/await.

  • intermediate
  • By Swift By Sundell
  • May 30

Tips and tricks for when using SwiftUI’s ViewBuilder

Explores SwiftUI’s @ViewBuilder: implicit use in View.body, applying it to custom containers, making sections optional with EmptyView or default args, caveats (closure-to-view only for stored props, multiple roots behave like Group), and a perf tip to resolve closures in init.

  • intermediate
  • By Swift By Sundell
  • Apr 15

Using Swift’s defer keyword within async and throwing contexts

Shows how defer guarantees cleanup across throws and async/await. Examples: close a Database connection, reset isLoading in an actor, and coalesce duplicate loads using a Task dictionary keyed by ID. For throws-only, Result can flatten flow. Note: defer runs at scope exit.

  • beginner
  • By Swift By Sundell
  • Mar 31

Swift by Sundell is back!

Swift by Sundell is returning. To address outdated/overlapping coverage, all previous posts were moved into a preserved Archive to reset topics. With six months of writing time funded by Genius Scan, new Swift articles are rolling out, starting with Modern URL construction in Swift.

  • advanced
  • By Swift By Sundell
  • Mar 31

Modern URL construction in Swift

Safer URL construction in Swift: replace fragile URL(string:) with URL(init: StaticString) that fatalErrors with context, then a #staticURL macro to compile‑time validate literals. For dynamic URLs, use URL.appending(components:, queryItems:) and new directory constants (iOS 16+). Trade off macro complexity vs safety.