Majid's Blog about Swift development

Building BarChart with Shape API in SwiftUI

This week I want to show you how to use Shape API in SwiftUI. We will take a look at ready to use shapes like Circle, Capsule, Rectangle, etc. We will learn how to draw super custom shapes by using Path and GeometryReader. In the end, we will build BarChart implementation ultimately in SwiftUI.

ViewModifiers in SwiftUI

ViewModifiers play a significant role in SwiftUI. Most of the functions called on a View are ViewModifiers. It is the primary way of modifying the view instance in SwiftUI. In this post, we will take a look at some ready to use ViewModifiers, and then we will build our own custom ViewModifier.

Introducing Container views in SwiftUI

During app development using SwiftUI, you can see that your views are very coupled with the data flow. Views fetch and render the data, handle user input and actions, etc. By doing so many things views become very fat and we can’t reuse them across the app. Let’s take a look at a different way of decomposing views by using Container views.

Alerts, ActionSheets, Modals and Popovers in SwiftUI

Last week we talked about Navigation in SwiftUI. This week I want to continue the topic with Modals, Alerts, ActionSheets, and Popovers. SwiftUI views have a dedicated modifiers for presenting this kind stuff. Let’s take a look at how we can use modifiers to display Modals, Alerts, ActionSheets, and Popovers.

Navigation in SwiftUI

This week I want to talk about Navigation in SwiftUI. SwiftUI provides both declarative and imperative ways of implementing navigation in your apps. Today we will cover two ways of Master-Detail navigation available in SwiftUI. We will learn how use NavigationLink, and how to do programmatic navigation in SwiftUI.

Gestures in SwiftUI

SwiftUI has a powerful and easy to use approach in building Gestures. Today we will talk about how we can use gestures in SwiftUI. We will touch special GestureState Property Wrapper which is very similar to State but works only with gestures. Finally, we will build swipeable Tinder cards as a sample project.

Managing Data Flow in SwiftUI

Last week we talked about Animations and Transitions in SwiftUI. But it’s time to touch the crucial aspect of every app, and it is Data Flow. All the apps have data to present or mutate. Data plays a vital role in apps using SwiftUI. Every view in SwiftUI is just a function of some state, where the state is our data.

Animations in SwiftUI

SwiftUI brings declarative and straightforward approach in building User Interfaces. We have List and Form components and Bindings. All of these things make SwiftUI so easy to use and very powerful. But today we are going to talk about another feature of SwiftUI, and it is Animations.

Building forms with SwiftUI

Apple finally released Xcode Beta 2 with an updated version of SwiftUI. The current version has a Form component which appeared on WWDC sessions. Today we are going to build form styled layout with SwiftUI. I want to show you a real-life example of the settings screen built with SwiftUI’s new Form component.

Understanding Property Wrappers in SwiftUI

Last week we started a new series of posts about SwiftUI framework. Today I want to continue this topic by covering Property Wrappers provided by SwiftUI. SwiftUI gives us @State, @Binding, @ObservedObject, @EnvironmentObject, and @Environment Property Wrappers. So let’s try to understand the differences between them and when and why which one we have to use.