Questions tagged [swiftui-button]

58 questions
0
votes
1 answer

I can't dynamically add items to List. SwiftUI

I can't dynamically add items to List. SwiftUI. I'm new at SwiftUI, so i don't know why it's not working Don't pay attention to lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's…
user17015942
0
votes
0 answers

transition on button without toggle or withAnimation swiftui

I am trying to add a transition to a button but without using the .toggle() or withAnimation The way that I manage the hide and show the button its with incrementing myValue. var body: some View{ ZStack{ …
0
votes
1 answer

SwiftUI Buttons meant to increment or decrement score, does so with the value of OTHER buttons almost exclusively

I have five buttons in swiftUI, that are meant to increase or decrease a displayed score, based on the response to an alert with two options, triggered on button press. When pressing the button associated with a 200 point value, and responding to…
0
votes
1 answer

Display curved button with custom color

I am trying to achieve a Scrollview with buttons that have rounded corners and a custom color. Button(shoppingListItem.text) { removeFromShoppingList(itemId: shoppingListItem.item_id) } .overlay( RoundedRectangle(cornerRadius: 20) …
AntonSack
  • 1,021
  • 2
  • 25
  • 47
0
votes
0 answers

Change button text on last image of Slider in SwiftUI

I have an image slider with dot indicator named "Onboardingslider". I have used it in my another screen "onboard4" , I want to change the text of "next" button to "get started" only on last image of slider otherwise it stays "next". I have tried a…
bushra
  • 27
  • 4
0
votes
0 answers

Push to next View on button click from SwiftUI View which is inside UITableView Cell

I have one view named WelcomeView in SwiftUI which is having next button. so on click of next button I want to push my view to other view using NavigationLink. Problem that I am facing is I have to render my WelcomeView inside UITableView Cell in…
0
votes
0 answers

Refactored confirmation dialog doesn’t observe destructive Button role

I have an app where I have several buttons whose actions are shielded by a confirmation dialog. For example: @State private var confirmDeleteAll: Bool = false var body: some View { // ... Button { confirmDeleteAll = true }…
ScottM
  • 7,108
  • 1
  • 25
  • 42
0
votes
0 answers

Coding a SwiftUI button to trigger a Menu item

I am trying to design a button in swiftUI that will call 1 of the built in menu items (mac only). I know how to replace built in menu item & force it to share the same functionality with a button, but that is not what I want to do. I wish to click…
rbkopelman
  • 39
  • 3
0
votes
1 answer

How do I make buttons lead to other buttons in SwiftUI?

My code currently shows two buttons next to each other, one button being countries and the other being states. I want to make it so that once a button is pressed, a new set of buttons will appear. For example, if countries is pressed, the two new…
0
votes
1 answer

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 text in the button will not be truncated with ellipsis? This would assume no font size…
pinglock
  • 982
  • 2
  • 12
  • 30
0
votes
1 answer

How to uniquely get Button if I extract as a subview in SwiftUI

So I am making a simple restaurant bill splitting app and I have a button that I want to highlight when the user clicks on it. I also want the other buttons to be not highlighted. In UIKit it would be simple to do this using…
Tomas
  • 135
  • 1
  • 6
0
votes
0 answers

Is it exist better way to emplement lock/unlock button with swiftui?

I tried to implement lock/unlock button, but it was hard to make. In my case, I used two Image. One is Rectangle with a lock, another is just a rectangle. And using ZStack, made them as a one button. // mincho import SwiftUI …
0
votes
1 answer

SwiftUI Mac: Adding buttonStyle Makes Button Click Propagate to Parent

I am trying to create a situation in a SwiftUI Mac app where when I click a Button inside a parent view, only the Button's action is trigger—not any of the tap gestures attached to its parent. Here is a simple example that reproduces the…
Clifton Labrum
  • 13,053
  • 9
  • 65
  • 128
0
votes
1 answer

SwiftUI sheet presenting on tapping anywhere

I have created a @StateObject from where a Login page is presented: @StateObject var loginViewModel = //LoginViewModel Name and There is a Button inside Vstack like this VStack{ Button(action : {loginViewModel.show.toggle()}…
Ae Ri
  • 185
  • 1
  • 12
0
votes
2 answers

SwiftUI - Button inside a custom Collection view is not tappable completely

I have a set of buttons to show for the user and I used CollectionView to align the buttons. Each button is a Vstack with an Image and Text components. The tap is reactive only on the image but not on Text and the padding space around. I am looking…
Dinakar
  • 1,198
  • 15
  • 37