Learn iOS development the Swift way: concise articles for fast learning!
-
Swift Concurrency: Actors, isolated & nonisolated
Hey Swifters đź‘‹ In this guide, we will explore actor in Swift and a few other relevant topics as well. If you have dipped your toes into Swift Concurrency, you might have probably come across actor, isolated, and maybe even nonisolated. They might sound intimidating at first, but they are…
-
RegexBuilder in Swift
Hey Swifters 🙂 You might have used regular expressions in the past and would already know how messy and hard to read they can get, well in this guide we will explore the RegexBuilder in Swift that makes our lives easier. Lets start with: What Is RegexBuilder? RegexBuilder in Swift…
-
@dynamicCallable in Swift
Hi Swifters, Today we will explore the @dynamicCallable in Swift. Lets say you have a regular Swift struct, but you want to call it like a function. Sounds weird? Well, thats exactly what @dynamicCallable lets you do! It’s like giving your types superpowers they can pretend to be functions when…
-
Swift Continuations: withUnsafeContinuation, withCheckedContinuation and more!
Hey Swifters :), In this guide i would like to talk about continuations in Swift and their types. Let’s say you are working on your iOS app, and you need to use an old networking library that still uses completion handlers. But your shiny new Swift code is all async/await.…
-
Clean, Reusable Swift Code Using DRY Principle
Hey Switfers! đź‘‹Today we will explore the DRY principle to make our Swift code clean and reusable. So have you ever written a function, copy-pasted it somewhere else, tweaked a line or two, and thought, this looks kinda familiar? If so, you have probably broken a rule we all learn…
-
@_exported import in Swift
Hi Switers :), Today, we are going to explore a handy little feature in Swift. Lets say you are packing for a vacation but instead of packing just for yourself, you decide to pack extra clothes and snacks in case your friend forgets theirs. Generous, right? Well in Swift there’s…
-
Swift’s withoutActuallyEscaping: Escape Without Escaping?
Hi Switers 🙂, In this article, we will explore withoutActuallyEscaping function in Swift. Let’s say you have just started getting comfortable with closures in Swift. You’ve wrapped your head around things like @escaping, and you know it’s needed when a closure might stick around and run later, after the function…
-
Consume in Swift 5.9
Hey Swifters, today we will explore the consume operator in Swift 5.9. So, you are cruising through your Swift code, writing functions, structs, maybe even dabbling in generics. Then Swift 5.9 rolls in with something new, the consume operator. And if your first reaction is: “Wait… why do I need…
-
Typed Throws in Swift 6
Hi Swifters 👋🏻, Today i am going to talk about Typed Throws that were introduced in Swift 6. If you have written any Swift code, you might have probably bumped into try, catch, and throws. Or maybe you have wrapped something in a do block and caught errors like a…
-
withTaskGroup and withThrowingTaskGroup in Swift 6.1
Hi Swifters 🙂, in this article, I would like to talk about withTaskGroup and withThrowingTaskGroup in Swift 6.1. If you have ever worked with concurrency in Swift, you might have probably seen or used withTaskGroup or withThrowingTaskGroup, if not, thats okay, I will tell you why and when you should consider using…
-
Protocols in swift
Protocols are a cornerstone of Swift programming, enabling developers to define a blueprint for methods, properties, and other requirements that suit a particular task or functionality. They provide flexibility and a clean, modular design, making your Swift code more maintainable and reusable. Table of Contents 1. Introduction to Protocols in…
-
The Delegation Pattern in Swift
The delegate pattern is a cornerstone of iOS development in UIKit, enabling a class to delegate specific tasks to another object. This pattern promotes clean and modular code by adhering to the single responsibility principle, making your apps easier to maintain and extend. If you’ve ever worked with UITableView, UICollectionView,…
-
Mastering Generics in Swift: From Basics to Advanced Techniques
Hey there, Swifties! Whether you’re just starting out or looking to level up your Swift game, this post will walk you through everything you need to know about generics, complete with plenty of examples. What Are Generics? At its core, generics allow you to write flexible, reusable functions and types…
-
Stepper in SwiftUI
Today, we’re going to dive deep into the Stepper control – a versatile and user-friendly way to increment or decrement values in your SwiftUI apps. We’ll explore various ways to implement and customize Steppers, from basic usage to more advanced techniques. What is a Stepper? A Stepper in SwiftUI is…
-
Swift Collections: Mastering the Art of Data Wrangling
Hey there, Swift aficionados! Ready to dive into the world of Swift collections? Buckle up, because we’re about to embark on a journey through the data structures that make Swift such a powerful language. We’ll explore how to wrangle your data like a pro using Swift’s built-in collection types. Swift’s…