Posts from Swift

How to initialize @StateObject with parameters in SwiftUI

By Samim

In this tutorial, we will see how to initialize @StateObject with parameters in SwiftUI. We use the @StateObject property wrapper to manage the lifecycle of an ObservableObject. It.... Read More

How to enable multiple gesture simultaneously in SwiftUI

By Samim

In this tutorial, we will see how to recognize two gestures simultaneously in SwiftUI. SwiftUI normally only activates one gesture recognizer action at a time, and it prioritizes t.... Read More

Change background color of Rounded Corner Border Button in SwiftUI

By Samim

In this tutorial, we will see how to change the background color of the Rounded Corner Border Button in SwiftUI. We can simply create a rounded corner button with a border using a .... Read More

Always show the search bar in a navigation bar in SwiftUI

By Samim

In this tutorial, we will see how to keep the search bar always visible within the navigation bar. We can now add a search bar to our navigation views, this simplifies the process .... Read More

Round a double value to x number of decimal places in Swift

By Samim

In this tutorial, we will see how to round a double value to x number of decimal places in Swift. Suppose we have a number like 1.34127538359353. Sometimes, we might want to make i.... Read More

How to render raw markdown content in SwiftUI

By Samim

In this article, we will learn how to render raw markdown content in Text view in SwiftUI. Sometimes, we want the Text view to display the text as we have specified. Suppose I have.... Read More

How to make two views the same width in SwiftUI

By Samim

In this tutorial, we will see how to make two views the same width in SwiftUI. Suppose we are creating two buttons, as we know the button size normally depends on the label of the .... Read More

Adjust SwiftUI view’s background color for dark mode

By Samim

In this tutorial, we’ll explore how to dynamically change the background color of a view based on the system’s dark mode setting. Dark mode is a popular feature for exp.... Read More

Related Posts