SwiftUI Handbook — A comprehensive series of tutorials covering Xcode, SwiftUI and all the layout and development techniques.

Dream big, anything is possible now.

Part 2

Get better scroll performance by using LazyHStack and LazyVStack instead of HStack and VStack

With iOS 14, Apple gives you the ability to use lazy stacks in SwiftUI. While HStack and VStack load the content right away, LazyHStack and LazyVStack load the content as you scroll.

Create a native navigation for your app using the nav bar, large title and swipe gesture

The Navigation View in SwiftUI allows you to switch between views in a hierarchical way using the Navigation Bar, large title and swipe gesture.

Learn how to open a URL in the Safari browser and how to customize your Link

In this tutorial, we’ll learn how to open links when a user clicks an element. Links can open in the default browser. The link view takes in two parameters, the first one is the title and the second one is the destination which is the URL.

How to set and customize the native color picker in SwiftUI

The native color picker provided by SwiftUI displays the currently selected color and a floating color picker which allows users to select a new color from the color wheel.

How to let users pick a date and time using a dropdown wheel or a calendar style

The DatePicker allows users to set a particular date using a scrolling wheel. With SwiftUI 2, you also get access to the GraphicalDatePickerStyle() which displays a calendar as well as time.

How to design for iPadOS pointer using hoverEffect and onHover

With SwiftUI, you can add the hoverEffect and onHover modifiers to any view. These allow us to detect when the user is hovering an item. This is an interaction that is specific to iPadOS and macOS since it requires a pointing device like the trackpad or mouse.

How to create reusable components by using the Extract Subview option in SwiftUI

Just like in design tools and React, SwiftUI is component-based. To keep your code clean and reusable, you should turn them into components. SwiftUI gives you the ability to Extract Subview. This allows you to turn complex code into smaller chunks of code which leads to the code looking more organized and easier to read.

How to synchronize states across multiple views and set the constant for your preview

When you work with multiple components and need to synchronize the states, you’ll need to use Binding. In this tutorial, I’ll show you how to bind the states and set a default value for a Preview.

Work with static data in SwiftUI.

Working with static data allows you to quickly prototype and test realistic data before implementing the full API. In this tutorial, we’ll learn how to set the Data Model, set sample data and loop through the data.

How to present a full screen modal without the sheets UI

With SwiftUI, you can present a modal view that takes the entire portion of the screen instead of the modal sheets that you see since iOS 13.

How to hide your app's status bar with or without animation

In SwiftUI, you can hide the status bar by using the .statusBar modifier. This can be applied to any view, such as the Text.

Create a placeholder UI while loading using the redacted modifier

SwiftUI comes with a unique and effortless way to create a beautiful placeholder UI while lazy loading your app content.

How to apply a beautiful 3D transform while scrolling in SwiftUI

Horizontal scrolling is common in iOS and SwiftUI makes it super easy to set it up. On top of that, you can easily add animation to your scroll by using GeometryReader and rotation3DEffect.

How to loop and delay your animation using repeat, repeatForever, speed and delay

How to customize your Animation timing with the repeatCount, repeatForever, speed and delay modifiers. This is a great technique for creating looping loading animation, sequencing multiple animations or creating a nice intro animation.

How to programmatically link to another tab from any child view in SwiftUI

In SwiftUI, you can trigger a change of tab from any element of any view by using the selection tags and setting a binding with child views.

Using SafeAreaInsets, you can get the height of the status bar, tab bar dynamically

In SwiftUI, you can dynamically detect the status bar and tab bar height by using the GeometryReader. The best thing about GeometryReader is that it updates the values as you change your screen orientation and device size, which is perfect for adapting your layout.

Use the .sheet modifier to show a modal

You can present the built-in modal animation on top of your current view by using a single modifier, the .sheet modifier.

Load images from the Internet in your SwiftUI application with SDWebImage

Often times, you want to use an image from the Internet in your application. However, in SwiftUI you can’t directly use the Image View with a custom URL. Downloading images from the Internet requires asynchronous downloading and caching, and is quite complex.

Fortunately, there are a lot of built-in packages that deal with downloading and caching images for you, like Kingfisher or SDWebImageSwiftUI. In this article, we will focus on SDWebImageSwiftUI. It is a library built just for SwiftUI and is based on SDWebImage.

Create an "OnTapOutside" listener on dismiss a custom modal

If you want to show a custom modal in your application, and don’t want to use the default .sheet modifier, you can easily create an onTapOutside listener to dismiss your modal.

Use ForEach to loop through an array in a View and in a function

Iterating over an array of items is very common when coding. In this article, let’s look at how we can iterate over an array in a View, as well as iterate over an array in a function.

Learn how to use switch statements in Swift

switch statement listens to a variable x and executes some code depending on the value of x. The switch statement is best used when you have to deal with multiple cases and don’t want to use and if/else statement. 

Transform how dates are displayed in your application by using a Date Extension and DateFormatter

In this tutorial, How do we format a date as [weekday], [month] [day], as in the image below?

Cache your user's data with UserDefaults

When creating an application with authentication, it is essential to cache your user’s data. Even when the user quits the app, the data should still be there for the next time the user launches the app. We don’t want to ask the user to sign in every time they open the app, as that would be bad user experience.

UserDefaults is a class that does just that. It persistently caches the user’s preferences (the currency the user prefers for a store app, for example) as well as any other data you would want (the user’s ID, their email, etc.). It works as key-value pairs and is very simple to implement.

Use a View extension to dismiss the keyboard when the user taps outside of the keyboard area

SwiftUI doesn’t come with a built-in method to dismiss the keyboard in your application when the user taps outside of the keyboard area. Fortunately, it’s pretty easy to implement and only requires a few lines of code.

Add a video or an audio player to your SwiftUI application by using AVPlayer and AVKit

If you want to integrate a video or an audio player in your application, AVPlayer is the way to go. It’s easy and fast to implement, and provides all the necessary tools for you to manage the video.

Play, pause, change the video speed, get the current time or the duration, and add subtitles to a video, all using AVPlayer

AVPlayer comes with multiple built-in controls so you can control how your video is shown to the user. Learn how to set up an AVPlayer in your SwiftUI application by reading the Videos with AVPlayer section.

Use SwiftUITrackableScrollView to add a listener when the user scrolls

Unlike JavaScript, SwiftUI doesn’t come with a built-in onScroll listener. If you want to listen to a user scrolling in a ScrollView, you’ll need to create that yourself.

Open a web page in Safari when the user clicks on a link in your SwiftUI application

If you want to add a link to a Text in SwiftUI, you’ll need to call the .onTapGesture modifier as well as UIApplication.shared.open.

Call Apple's share sheet when the user clicks on a button

Showing a share sheet in your SwiftUI application requires only a few lines of code and is so easy to implement.

Learn the basics of Strings in Swift and how to manipulate them

In any programming language, a string is a data type and is basically a series of characters. Let’s learn about Strings in Swift.

Group 6 CopyCreated with Sketch.

More Information?

Fill out your details and we will get back to you as soon as possible.