Posts for: #SwiftUI

State Driven Enum Navigation

Navigating SwiftUI with an Enum Router (Cyclical A → B → C Flow) — A Simple example Introduction In this post, we’ll explore a lightweight, type‑safe way to manage navigation in SwiftUI by modelling screens as an enum and driving transitions with closures. We’ll illustrate a simple cyclical flow through three views—A → B → C → A—and then dive into the pros and cons of this approach. 1. Defining the Router State First, we define an enum with three cases—one for each screen.
Read more

SwiftUI Generic Containers

Want to make your SwiftUI views more reusable, composable, and clean? This post explores how to build your own generic containers using Swift’s type system and SwiftUI’s powerful @ViewBuilder + closure patterns. Whether you’re building custom layouts, DSL-like preview wrappers, or logic-driven composition — understanding generic containers is a key unlock. 💡 SwiftUI Tip: Wrapping Views with Generics and Closures I recently hit a situation in SwiftUI that seemed small at first — but led to a mini “aha!
Read more

An Introductory Example of Deeplinking in iOS

Hello everyone. Lately, I’ve been experimenting with deep links and SwiftUI. In the realm of iOS development, deep linking emerges as a powerful and indispensable tool, offering developers the means to seamlessly connect users to specific content or features within their applications. At its core, deep linking allows for the precise navigation to a particular section of an app, rather than merely launching the app’s home screen. Understanding the fundamentals of iOS deep linking is pivotal for enhancing user experience, promoting user engagement, and, ultimately, unlocking the full potential of your mobile applications.
Read more

A Simple Full-Stack iOS App Example

One of the benefits of using Swift is its excellent performance and low memory footprint. This is a key point when doing backend programming. The future of Swift in Linux looks promising. With Swift 5.9, there will be better error logging, and Apple is developing a new open-source cross-platform testing framework with swift-testing that will replace XCTest and works on Linux too. Let’s hope this encourages more backend systems to be written in Swift.
Read more

SwiftUI – Horizontal Pages Carousel

Horizontal page carousels are a common element in iOS interfaces for presenting pages in a horizontal, swipeable format. They are particularly useful for showcasing views with varying content. Code In SwiftUI, creating such elements is straightforward. Let’s define a SwiftUIView and use the following code: import SwiftUI struct PageSliderView: View { // the data we want to present in each page, // this can be as simple as an array of string or as complex as an array of compound views.
Read more