#swiftui

Found 20 articles tagged with #swiftui

How to create rounded images in SwiftUI

Creating rounded images in your app's UI can be a design choice to enhance the visual appeal and provide a more modern or aesthetically pleasing look.

Aug 26, 2024#swiftui

SwiftUI .task() vs .onAppear()

The exact moment that SwiftUI calls these methods depends on the specific view type that you apply to, but the action closures complete before the first rendered frame appears.

Aug 23, 2024#swiftui

How to create gradient colors in SwiftUI

SwiftUI provides excellent support for creating and customizing gradient colors in your user interfaces. This allows for creating visually appealing and dynamic effects.

Jul 10, 2024#swiftui

How to use @ViewBuilder in SwiftUI

In SwiftUI, @ViewBuilder is a special attribute used to build views. It is a result builder that allows you to construct views in a more declarative and readable manner.

Jul 04, 2024#swiftui

How to dismiss keyboard in SwiftUI

The primary way is to use the @FocusState property wrapper in conjunction with the .focused modifier to control the keyboard’s visibility.

Apr 28, 2024#swiftui

Using custom environment values in SwiftUI

Custom environment values are useful when you have data that multiple views need access to, but you don't want to pass them down manually through each view's initializer.

Apr 25, 2024#swiftui

How to config launch screen in SwiftUI

Launch screen is the initial screen that appears when your app is launched. It provides a seamless transition from launching the app to displaying its first screen.

Apr 22, 2024#swiftui

Hiding the keyboard when scrolling in SwiftUI

For most cases, using the scrollDismissesKeyboard modifier is the simpler and more recommended approach, especially with SwiftUI 16 and later.

Apr 21, 2024#swiftui

StateObject vs ObservedObject in SwiftUI

Use StateObject when the view is the source of truth for the object, ObservedObject when the object’s lifecycle is managed outside the view, such as when it’s passed into the view.

Apr 18, 2024#swiftui

How to dismiss a sheet in SwiftUI

There are several ways to dismiss views in SwiftUI like using a @Binding variable, dismiss environment value or deprecated presentationMode.

Jan 07, 2024#swiftui