Category "swiftui"

How to consecutively present two alert views using SwiftUI

I want to immediately present the second alert view after click the dismiss button of the first alert view. Button(action: { self.alertIsVisible = true })

How to popup a document picker in ios and macos using catalyst

I'm trying to popup a document picker using mac catalyst, but all I get is a blank screen. All works well on ios 13.2.2 on iPad and iPhone, but not on macos 10

UIDocumentPickerViewController doesn't show any contents on Mac Catalyst

UIDocumentPickerViewController works on iOS but not on Mac Catalyst. Is there any alternatives to workaround this issue? BTW, NSOpenPanel is unavailable on Mac

Using user input in SwiftUI to perform calculations

I'm making a school project in which I have to find the weight of a person on different planets, but I am confused about how I should use the input and multiply

SwiftUI animation not working using animation(_:value:)

In SwiftUI, I've managed to make a Button animate right when the view is first drawn to the screen, using the animation(_:) modifier, that was deprecated in mac

SwiftUI overlay cancels touches

I have a button and I'd like to put a semi-transparent gradient overlay on top of it. Button(action: { print("Pressed") }) { Text("Press me") } .overlay(

SwiftUI display gif image

The way to display animated gif image in swiftUI because of Image Image("fall-leaves") does not support gifs answer below

Clickable area of SwiftUI Picker overlapping

I am currently trying to create a page with three adjacent Picker views inside of an HStack as seen below: I made a CustomPicker view where I limit the frame t

SwiftUI Widget: 'main' attribute can only apply to one type in a module

I've created a Widget and I'm adding @main on top of the declaration. However, when I switch to the Widget extension target and run it, I get the error 'main' a

SwiftUI strange behavior when moving items between sections in a List

so I've been trying to make a component using swiftUI that allows you to move items in a List between sections. I prepared an example with two sections: "First

ADA - Programmatically shifting VoiceOver focus to another SwiftUI view - compatible with IOS 13+

Overview: I'm having difficulty understanding how to properly programmatically shift accessibility focus in a SwiftUI view compatible with IOS 13+. This means u

How to define a protocol to include a property with @Published property wrapper

When using @Published property wrapper following current SwiftUI syntax, it seems very hard to define a protocol that includes a property with @Published, or I

Cannot use mutating getter on immutable value: 'self' is immutable error

I'm trying to reuse an older piece of Swift code, but getting an error 'Cannot use mutating getter on immutable value: 'self' is immutable error'. Xcode wanted

How to pass one SwiftUI View as a variable to another View struct

I'm implementing a very custom NavigationLink called MenuItem and would like to reuse it across the project. It's a struct that conforms to View and implements

UIPageViewController swipe ignores SwiftUI's navigationBarHidden(true)

I'm creating a SwiftUI app that needs a slider with hundreds of pages. Since there's no first-party solution that fits my needs, I've adapted UIPageViewControll

Round Specific Corners SwiftUI

I know you can use .cornerRadius() to round all the corners of a swiftUI view but is there a way to round only specific corners such as the top?

Open multiple previews at the same time in SwiftUI

I know we can open multiple previews of different screens at the same time in SwiftUI. Can anyone help me with the steps to achieve that?

This SwiftUI animation should only fade out. Why does it move to the right?

I'm having a hard time understanding why this happens. I reduced the problem to its minimum expression. I have a single Text view, that when removed, should jus

SwiftUI: How to make TextField become first responder?

Here's my SwiftUI code: struct ContentView : View { @State var showingTextField = false @State var text = "" var body: some View { return

Find all available images for Image(systemName:) in SwiftUI

Where can I find all the system images that are available in the initializer Image(systemName:)? I've only been using "chevron" and "star.fill" so far, as disco