Category "swiftui"

contentInset on SwiftUI's List

Is there a way how to set contentInset on SwiftUI's List? I need to adjust the bottom inset to have the last item visible above the bottom button. My current s

SwiftUI navigation bar inline mode searchable issue

I've noticed a pretty big issue when using inline navigation bar display mode and searchable on my List in my app. When selecting the navigationlink it’s

How to know when SwiftUI keyboard search button tapped in .searchable search window

I am using the .searchable modifier in SwiftUI. Is there anyway to know when the user presses the search key on the keyboard? I know how to do this by using a

How can I make a background color with opacity on a Sheet view?

I'm currently developing an application using SwiftUI. I'm looking for some way to make a background color with opacity on a Sheet view. is there any way to do

SwiftUI/Combine: subscribe to value change of @Binding

I have a view with a view model, and actions in this view can change the view model. To be able to break out logic into reusable pieces, I have part of the view

SwiftUI ToolbarItem doesn't present a View from a NavigationLink

I don't know if this is a bug or I am doing something wrong here. I've added a new button on the Navigation bar that would present a new view. struct MyView: Vi

Click on a MapAnnotation to expand view - SwiftUI

I have a MapAnnotation in SwiftUI. On user interaction with a annotation, can I display another piece of information, i.e., change the label or show additional

SwiftUI Constraint Issue For NavigationTitle in iOS 15

I'm having an issue with Xcode throwing a constraint message in the console every time I use a NavigationTitle. I'd like to say that I've read through the follo

Why doesn't SwiftUI onTapGesture always work

The onTapGesture in SWiftUI doesn't work reliably. This example shows the problem, which is that sometimes when you tap on a cell, the background changes to gr

How to pass @namespace to multiple Views in SwiftUI?

I'm playing with the new Xcode 12 beta & SwiftUi 2.0. .matchedGeometryEffect() modifier is great to do Hero animations. There is a new property @Namespace i

How to determine width needed for a button in SwiftUI

If I have a string that I will place inside of a SwiftUI button label, how can I determine how much width I need to allow the button to consume such that the te

SwiftUI List not updating when core data property is updated in other view

@State var documents: [ScanDocument] = [] func loadDocuments() { guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {

Sheet inside ForEach doesn't loop over items SwiftUI

I have an issue using a sheet inside a ForEach. Basically I have a List that shows many items in my array and an image that trigger the sheet. The problem is th

How to use fullScreenCover with iOS 14 but sheet for 13

Imagine you've built a screen that utilizes the sheet API to present modal sheets, and now with SwiftUI 2.0 you want to use fullScreenCover instead when run on

SwiftUI Dependency Injection

I have a SwiftUI app, its a tab based app struct Tab_View: View { var body: some View { TabView{ Main1_View().tabItem {

Can you get rid of opaque rectangle in a UIPickerView?

I'd like to remove this gray box in a UIPickerView. I'm trying to recreate this. If there is a way I'd greatly appreciate it. Here's the code snippet. I'm not

SwiftUI: dismiss List searchable keyboard?

I have a view that uses searchable. I would like do dismiss the keyboard programmatically if user starts scrolling on the List. Same behavior as you see in the

Button with double action (tap & long press) in SwiftUI

Is it possible in SwiftUI to set a button with an action on tap and a different action on long press ? I have tried this: Button(action: { self.handleButton

How to change PageTabView programmatically in iOS 14, SwiftUI 2?

I'm exploring new things came in Xcode 12 and SwiftUI 2.0 I have created a pageview onboarding screen with TabView and PageTabViewStyle in Xcode 12, iOS 14, Swi

SwiftUI | Using onDrag and onDrop to reorder Items within one single LazyGrid?

I was wondering if it is possible to use the View.onDrag and View.onDrop to add drag and drop reordering within one LazyGrid manually? Though I was able to make