Category: Swift

  • @preconcurrency in Swift

    @preconcurrency in Swift

    Hey Swifters đź‘‹ I this guide we will explore @preconcurrency in Swift. You have probably been loving the new Swift Concurrency features async/await, Task, actor, and the rest of the crew. But sometimes you have to interact with older code, the kind that wasn’t written with concurrency in mind. And that’s when you might stumble…

  • Swift Concurrency: Actors, isolated & nonisolated

    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 actually your friends, especially when…

  • RegexBuilder in Swift

    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 is a type-safe, compile checked…

  • @dynamicCallable 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 they are really not. Lets…

  • Swift Continuations: withUnsafeContinuation, withCheckedContinuation and more!

    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. It’s like trying to connect…

  • Clean, Reusable Swift Code Using DRY Principle

    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 (and forget) early on The…

  • @_exported import in Swift

    @_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 a feature that does something…

  • Consume in Swift 5.9

    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 this? I’ve been doing just…

  • Typed Throws in Swift 6

    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 pro. Well, That’s great! But…

  • withTaskGroup and withThrowingTaskGroup in Swift 6.1

    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 it. These APIs let you…

  • Protocols in swift

    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 Swift In Swift, a protocol…

  • The Delegation Pattern in Swift

    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, or UITextField, you’ve already encountered…

  • Mastering Generics in Swift: From Basics to Advanced Techniques

    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 that can work with any…

  • 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 Core Collections Swift gives us…

  • Map in Swift

    Hey Swift enthusiasts! Today, we’re diving deep into one of Swift’s most powerful higher-order functions: map. If you’ve ever wanted to transform elements in a collection without breaking a sweat, you’re in for a treat! What is Map? At its core, map is a method that transforms each element in a collection using a provided…