Tag: Swift View All Posts

Error Handling in Swift

Swift uses typed errors and `throw` to represent operations that can fail. Handling those failures explicitly makes code easier to understand and gives your app a chance to recover.

Swift Errors
Read article

Protocol Extensions in Swift

Protocols describe capabilities that types can adopt. Protocol extensions let you provide shared behavior for those types without requiring a common superclass.

Swift Protocols Extensions
Read article

Swift Testing Framework

Testing is how you verify your code works correctly and keeps working as you make changes. Swift provides XCTest for unit and UI testing, and Swift 5.9+ introduced the new Swif
Swift Testing XCTest
Read article

URLSession with async await

Modern Swift makes network requests easier to read with `async` and `await`. `URLSession` provides asynchronous methods that return data and a response without compl
Swift URLSession Networking
Read article

Custom Codable Implementations in Swift

Swift's `Codable` protocol makes converting models to and from JSON straightforward. The compiler can synthesize most implementations, but APIs do not always use
Swift Codable JSON
Read article

Property Wrappers Deep Dive

Property wrappers are a Swift feature that allows you to define reusable logic for getting and setting property values. They reduce boilerplate code and enable elegant so
Swift PropertyWrappers
Read article

Result Builders in Swift

Result builders (formerly known as function builders) are a powerful Swift feature that enables you to create elegant domain-specific languages (DSLs). They're the magic be
Swift ResultBuilder DSL
Read article

Swift Concurrency Best Practices

Swift Concurrency provides modern tools for handling asynchronous code through async/await, actors, and structured concurrency. Following best practices ensur
Swift Concurrency async/await
Read article

Observation Framework in Swift

The Observation framework is a modern Swift feature that provides automatic change tracking for observable objects. It replaces `ObservableObject` with a cleaner, m
Swift Observation SwiftUI
Read article

SwiftData Basics

SwiftData is Apple's modern framework for data persistence, introduced in iOS 17. It provides a Swift-native way to model and persist data using macros and property wrappers, m
SwiftData Persistence Swift
Read article

Task.sleep() vs. Task.yield(): The differences explained

Task.sleep() vs. Task.yield() The differences explained

What is Task.sleep()?

With [Task.sleep()](https://developer.apple.com/documentation/swif

Swift Task
Read article

The Identifiable Protocol in Swift

The Identifiable protocol is a fundamental building block in Swift and SwiftUI that enables unique identification of instances. Understanding how to effectivel
Swift Identifiable SwiftUI
Read article

Remove the background from images using Swift

Removing backgrounds from images is a common task in modern apps, whether for photo editing, social media, or automation. In this article, you'll learn how to build a

Swift
Read article

Surprise Route

In this post, I'll take you tough the process of creating my app in Swift(UI). This app is designed to generate random routes for walking or biking, making your
Swift
Read article

Thermal States on iOS

You can read the thermal states on iOS documentation to understand how to manage the thermal state of your iOS application. This is important for optimizing performance and battery life.

iOS Swift
Read article

Building xcstrings-translator

xcstrings-translator is a tool to (easily) translate `.xcstrings` files, It is a GUI tool, written in Swift and SwiftUI to translate `.xcstrings` files to different languages
Swift xcstrings
Read article

Tips and ideas to start your own blog

When I started on 03 February 2024 I was unsure if I would be able to keep it up. I had tried to start a blog some times before but I alw

Swift Blog
Read article

NumberFormatter

NumberFormatter is a class that provides a flexible and easy way to convert numbers into strings and vice versa. It is a part of the Foundation framework and is available on all App
NumberFormatter Swift
Read article

Dutch.swift

For april fools day, I wanted to write a Swift library that allows you to write Swift code in Dutch. It's called and it's available on GitHub. Unfortu

Swift
Read article

NavigationStack

is a SwiftUI view that provides a navigation stack for macOS and iOS. Navigation was done usin
NavigationStack Swift
Read article

JavaScriptCore

Whether you love it or hate it, JavaScript has become the most important language for developers in the world today. Yet despite any efforts we may take to change or replace it we’d b
JavaScriptCore Swift
Read article

Expressible Literals

Expressible Literals in Swift are a powerful feature that allows you to create custom types that can be initialized using literals. This post will show you how to create y
Swift expressible-literals
Read article

Using MetricKit

In this post, I will show you how to use MetricKit to collect and analyze performance data from your app.

What is MetricKit?

MetricKit is a framework introduced in iOS 13 that allows y

MetricKit Swift
Read article

Contact Provider Extension

The framework lets your app create (business) contacts on the user's device. It is the prefer
ContactProvider Swift
Read article

Understanding Sendable in Swift

With the introduction of Swift 5.5, Apple brought significant enhancements to concurrency, including the Sendable protocol and the @Sendable attribute. These additio

Swift Sendable
Read article

Understanding reducers in Swift

Reducers are a powerful concept in Swift, allowing developers to transform sequences of values into a single result.
This technique is particularly useful when you need to p

Swift reduce
Read article

Translation framework in Swift

Exploring the Translation Framework in Swift

With the release of iOS 17.4, Apple introduced the Translation framework, a powerful tool that allows devel

Swift Translation Framework
Read article

Understanding assertions in Swift

Assertions are a powerful tool in Swift that help developers ensure their code behaves as expected during runtime. They allow you to test assumptions and catch potential issu
Assert Swift
Read article

A Guide to UI Testing in Swift

User Interface (UI) testing is a crucial aspect of app development, ensuring that your app's interface behaves as expected under various conditions.
This guide will

Swift UITest XCUITest
Read article

iOS Settings URL's

This is a list of internal URLs for settings on your iPhone, iPad, ...
Please note that this list will be updated if required, if you see something which is not right, please drop

Swift iOS Settings
Read article

What is @frozen

In this post, we'll explore the `@frozen` attribute in Swift, a compiler directive that can be applied to `enum` declarations to optimize memory layout and improve performance. By marking an `
Swift Frozen
Read article

Enums

In this post, we'll explore enums in Swift, a powerful feature that allows you to define a group of related values. Enums are commonly used to represent a fixed set of options or states in your code, mak
Swift Enums
Read article

Difference between map, flatMap, compactMap

In this post, we'll explore the differences between `map`, `flatMap`, and `compactMap` in Swift. These three methods are commonly used when working
Swift map flatmap compactMap
Read article

CoreSpotlight

CoreSpotlight is a framework provided by Apple that allows you to index and search content within your app. It provides a way to make your app's content searchable and discoverable by use
CoreSpotlight Swift
Read article

@ViewBuilder in Swift

SwiftUI, Apple's declarative framework for building user interfaces, introduces several powerful tools to streamline UI development. One such tool is the `@ViewBuilder` attribute, w
ViewBuilder Swift
Read article

Loging using OSLog

OSLog is a Swift API that provides a unified logging system for all Apple platforms. It is a replacement for the older `print` and `NSLog` functions. OSLog is a more efficient and secure log
Swift OSLog
Read article

Generics in Swift

Swift, offers a powerful feature called generics that greatly enhances code reusability, efficiency, and safety. In this blog post, we will dive deep into generics and explore how the

Swift Generics
Read article

Variadic Parameters

These versatile constructs allow us to handle a variable number of arguments of the same type within a function.

What are Variadic Parameters?

In Swift, variadic parameters enable a fu

Swift
Read article

If case let

This concise syntax provides a convenient shortcut when you want to match a single case without writing a full-blown `switch` statement. Although it might seem a bit backward at first, once you grasp its
Swift
Read article

self, Self, and Self.self in Swift

Let's dive into the fascinating world of `self`, `Self`, and `Self.self` in Swift. These seemingly similar constructs have distinct meanings and use cases.

What is `self

Swift self
Read article

ExpressibleByStringLiteral URL

The ExpressibleByStringLiteral protocol is a powerful feature in Swift that allows us to create custom types directly from string literals. Essentially, i

Swift ExpressibleByStringLiteral
Read article

Subscripts in Swift

Subscripts provide a convenient way to access the elements of a collection, list, or sequence directly by index. Whether you’re dealing with arrays, dictionaries, or custom types, subscripts al
Swift
Read article

Default values for UserDefaults

UserDefaults (NSUserDefaults) is a go-to database for saving users' preferences over application behavior.

What is UserDefaults?

UserDefaults is a simple key-

Swift UserDefaults
Read article

TipKit

Let's delve into the fascinating world of TipKit, a powerful framework that empowers developers to create and customize app tips.
Whether you're aiming to introduce new features, reveal hidden f

TipKit Swift
Read article

Localizing In Xcode

Localizing and Varying Text with a String Catalog

Your app's success hinges on delivering an exceptional experience to users across different locales. Localization is

Xcode Swift Localization
Read article

Translating closures to async

In this post, we will discuss how to translate closures to async in Swift.

What is continuation?

In Swift, a continuation is a construct that allows you to suspend and resu

Async Swift
Read article

Aurora Editor

Aurora Editor: A Swift-Powered IDE for Efficient Coding

Introduction

As developers, we're always on the lookout for tools that enhance our productivity, streamline our workf

Aurora Editor Swift
Read article

SimpleNetworking

Today i write about my Swift package .
It's a simple networking library for Swift it is a wrapper around URLS

SimpleNetworking Swift SwiftPM
Read article

@dynamicMemberLookup

Let's delve into the fascinating world of Swift's `@dynamicMemberLookup`. This attribute, introduced in Swift 4.2, provides a powerful mechanism for accessing properties and
dynamicMemberLookup Swift
Read article

async/await

Let's delve into the fascinating world of Swift's async/await.
This powerful feature, introduced in Swift 5.5, revolutionizes asynchronous programming, making it more intuitive and r

async await Swift
Read article

Implementing Admob in SwiftUI

Recently i was working on a that required me to implement Admob in a SwiftUI app.

I encountered some issues while implementing Admob

Swift Admob
Read article

OTP Code Generation with CryptoKit: A Swift Approach

Introduction

In the realm of secure authentication, One-Time Passwords (OTPs) play a crucial role. Whether it's two-factor authenticat

Swift CryptoKit TOTP
Read article

Snippet: @EnvironmentVariable

If you are creating commandline apps you sometimes need to acces the operating system environment variables, while you can use `get

Swift Observable MacOS EnvironmentVariable propertyWrapper
Read article

Observable Geocoder

Firstly we want to import CoreLocation for the location services.

We're going to construct a basic class, which subclasses ObservableObject.


class Geocoder: ObservableOb
Swift Observable
Read article

Easy Publishers

Ever wondered how to create a simple publisher?

In this blog i'll try to show you the basics

Firstly we need to import the required frameworks


// Used for the ObservableObject
Swift Observable
Read article