Tag: SwiftUI

SwiftUI apps at scale

SwiftUI is fantastic, but not perfect. Some of these imperfections are expected from a nascent 4-year-old framework, but just one creates the roadblock to wider adoption. Today, I’m going to tell the story of my SwiftUI journey at 3 startups; and explain my solution to the critical fl...

SwiftUI Testing: a Pragmatic Approach

During the last few months, I’ve been reading “Unit Testing Principles, Practices, and Patterns” by Vladimir Khorikov. It’s definitely one of the best books I’ve read about testing. One of the things I’ve liked the most is that the author offers a “fram...

What’s this some in SwiftUI?

At this year’s WWDC, Apple introduced SwiftUI — a completely new approach to create user interfaces in Xcode in a declarative way. To help you get started with the new framework, they published some beautifully designed tutorials. Some advice upfront: If you get...

Modularised Navigation in SwiftUI — An Enum-based Approach

In iOS 16, SwiftUI finally allows us to properly encapsulate navigation without being forced to pass a ton of bindings or using NavigationLink directly in UI. One thing that always introduces additional challenges, though, is modularisation. In a best-case scenario, every module func...

10 Deadly SwiftUI Mistakes and How You Can Avoid Them

Swift and SwiftUI are powerful tools for creating beautiful and responsive apps for iOS, macOS, watchOS, and tvOS. However, learning these technologies can also be challenging and frustrating, especially if you encounter some common pitfalls and errors along the way. In this article, I will share...

An Autopsy of SKEmitterNode (With a Conversion to SwiftUI)

The most downloaded apps are games, most of which have an element that could be described as an explosion; an animation to denote success, failure or even perhaps celebration. Explosions are crafted mainly using EmitterNodes, available in SpriteKit, SceneKit and the CAAnimation framew...

ContentUnavailableView : iOS 17 & SwiftUI 5

Empty state screen in apps provide essential advantages. They offer clear and informative guidance to users when there’s no content to display, reducing confusion and frustration. This proactive approach enhances the user experience by maintaining engagement and preventing abandonment. Empt...

Unlocking SwiftUI at Airbnb

When constructing an app’s user interface (UI), the choice of framework is incredibly important. The right UI framework can make an app feel smooth, responsive, even delightful, while a UI framework that doesn’t match an app’s needs can make it feel sluggish and broken. This princi...

Admob Banner Ad in SwiftUI application

It’s pretty easy to show ads in your iOS app using Admob and generate smart revenue. If you are new to iOS, you may find it complicated. To show ads, you have to include Admob SDK first. In SwiftUI application, it’s one click away! Setup Add Admob SDK to SwiftUI application usin...

SwiftUI: Introducing MVI How to Easily Implement MVI in SwiftUI

Introduction: Efficient and structured application development is a key to success in the world of software development. One approach that can help achieve this goal is the Model-View-Intent (MVI) pattern. In this article, we will discuss the concept of MVI and how we can implement it in applicatio...

[SwiftUI]How to use sheets (sheet)

Utilizing the sheet functionality in SwiftUI allows you to present a view in a distinctive manner. Unlike a traditional full-screen presentation, a sheet appears as a card that overlays the original content, providing a partially transparent view of the underlying screen. In SwiftUI, the coding s...

Using Static Quick Actions To Navigate To Different SwiftUI Views

Quick actions have been available for iOS devices since the release of iOS 13. Quick actions can be used on the Home Screen to utilize an app’s main functionality before it is opened. To use a quick action simply tap and hold an app’s icon on the Home Screen and a quick action menu will ...

SwiftUI apps at scale

SwiftUI is fantastic, but not perfect. Some of these imperfections are expected from a nascent 4-year-old framework, but just one creates the roadblock to wider adoption. Today, I’m going to tell the story of my SwiftUI journey at 3 startups; and explain my solution to the critical flaw...

A Deep Dive Into Observation: A New Way to Boost SwiftUI Performance

Before Swift 5.9, Apple did not provide developers with a unified and efficient mechanism for observing changes to reference type properties. KVO is limited to use by NSObject subclasses, Combine cannot provide precise observation at the property level, and neither can achieve cross-platform support...

SwiftUI Testing: a Pragmatic Approach

Those traits are what the author calls “the four pillars of a good unit test”. And the interesting part is that we cannot maximize all of them. Some types of tests provide the best protection against regression and resistance to refactoring but with very slow feedback (like UI testing). ...

Coding in SwiftUI? Don’t Start Without These 5 Must-Have View Extensions!

SwiftUI offers a hidden gem that often goes overlooked: custom ViewModifiers. This powerful tool enables you to build reusable modifiers that can enhance your SwiftUI Views by seamlessly adding and transforming elements to fit your needs. If you’ve worked with SwiftUI for more than 4 minute...

TextEffects With SwiftUI and Physics

I’m a fan of SwiftUI. I have been using it since its launch in 2019. In those five years, it has come a long way and had many updates, although some argue it isn’t ready for prime-time. One of those prime-time features not available within SwiftUI is the iOS physics engine in the true...

Creating Complex SwiftUI Shapes Using Design Tools

Shapes and Paths are powerful primitives that can be used in many situations. However, there are instances when more complex shapes are needed. Apple has provided support for custom drawing with two integrated tools: Paths and Shapes. A Shape is made up of a serie...

iOS — How to write Unit test, UI test for SwiftUI applications

In application development process, testing is a crucial aspect of the development process that ensures the quality, reliability, and correctness of an applications. The benefits of testing include preventing bugs, reducing development costs, improving performance before the app is released to the p...

Implementing address autocomplete using SwiftUI and MapKit

Surprisingly for myself, I realized that I have never implemented address autocompletion using only Apple technologies. Before, I had experience only with Google Places SDK and even with the not-so-well-known European GeoDataHub. I found it curious — to know how we can limit our...

Swift Charts: How to Make Stacked Bar Charts in iOS and SwiftUI

If plain vertical and horizontal bar charts aren’t enough, and you want to add another dimension to your data visualizations, well, you’re in luck. Stacked bar charts allow you to cram in extra data without ruining the aesthetics or user experience, and today you&rsqu...

Build a 3D Editor in SwiftUI and SceneKit

I was working on an article that relied on having a 3D editor of sorts to set up a simulation, and well — more than halfway through, it became evident that the simple editor I had built was not going to cut it. So I decided to document my journey rebuilding said the simple editor. Join me in t...

How to show Skeleton/Loader in SwiftUI with redacted

In SwiftUI, redacted is a modifier used to obscure or "redact" sensitive information when displaying data in a view. It is often used for privacy or security reasons, especially when you want to display placeholders for data while keeping the actual content hidden. This is partic...

Setting Up Live Activities for the Dynamic Island in SwiftUI

iOS 16 has brought a great new feature that’s sure to add value when implemented in new and interesting ways for a whole host of developers. Live Activities and their implementation though could do with a bit of explanation as there are a few steps involved in getting started. I’ve ou...

SwiftData by Example: iOS 17 & SwiftUI 5 — Part 13

We are leveraging power of predicate based filtering to drive the search experience in the app. It would make sense to offer sorting option as well. We have already seen Query driven sort for book genre. Offering sorting options in apps yields numerous benefits. It enhances the user experience by...

Create a Scalable SwiftUI MVVM Project

SwiftUI is the booming new framework built by Apple, and it’s built on top of their open-source coding language Swift. While it still has some catching up to do with UIKit in terms of functionality, SwiftUI provides developers with declarative syntax for creating views. As a result, it can hav...

SwiftUI at Airbnb: A Case Study

In recent years, SwiftUI has been making waves in the world of iOS app development. It represents a significant shift in how developers approach building user interfaces for Apple’s platforms. One company that has embraced this technology and reaped the benefits is Airbnb. In this article, ...

SwiftData in SwiftUI (Part 1)

Model Container An object that manages an app’s schema and model storage configuration. Model Container is set in WindowGroup. We can pass multiple data models over there. @main struct SwiftData_ExampleApp: App { var body: some Scene { WindowGroup { ...

Scroll to Index in SwiftUI

The scroll view reader’s content view builder receives a ScrollViewProxyinstance; A proxy value that supports programmatic scrolling of the scrollable views within a view hierarchy. with the use of proxy’s to perform scrollTo(index)scrolling. ScrollViewProxyscans all scroll ...