Category "swiftui"

Why is ForEach not changing my Foreground color correctly in SwiftUI?

I am trying to make a simple Todo app and I'm trying to implement a feature where if I click on a row, the foreground color will be change. However, I have two

Editing a TextField in preview

I am trying to add a TextField in SwiftUI. It successfully appears with the initial text, but it is not editable in the preview display, only when I run a simul

SwiftUI tvOS custom Button missing accessibility Focused state

TL;DR: Is there any way to have custom button style (custom pressed state) in SwiftUI on tvOS while it is still working correctly with Accessibility Focus API a

Focus on a TextField using a keyboard shortcut

I have a macOS Monterrey app that has a TextField on the toolbar. I use this to search for text on my app. Now, I'm trying to add a keyboard shortcut to focus o

How the remove the yellow bar for "strong password" for SecureFields in SwiftUI?

I am new to SwiftUI and am trying out the SecureFields now. I am using two SecureFields in one VStack and for some reason when I use the iOS keyboard they show

Simple app for tvOS - but not simple for me. Looping my movie

I'm total newbie in coding and are trying to make a small app for my own. This is working as I want but I've no idea how to make the movie loop? Tried to look e

Memory leak issue virtual camera macOS, swift SwiftUI zoom caphost

We are developing a application with virtual camera plugin for macOS by using swiftUI & swift. It has also C++ & objective C library. When we use that p

SwiftUI - Adding a keyboard toolbar button for only one TextField adds it for all TextFields

Background I have two TextFields, one of which has a keyboard type of .decimalPad. Given that there is no 'Done' button when using a decimal pad keyboard to clo

Pass data JSON API to .sheet(isPresented) SwiftUI

How to pass data to .sheet(isPresented) I have 10 names that I get from my JSON API, but when I click on the name, the .sheet(isPresented) shows one name. In al

iOS 15 only view modifier causes crash on iOS 14 even with if #available(iOS 15.0, *)

I'm using SwiftUI's drag & drop modifiers. Since, iOS 15 gives an option to customise the onDrag modifier with a preview I'm using it as shown below. Issue:

Marking makeUIView func makes view NOT conform to UIViewRepresentable?

I am trying to update my map's style URL immediately when the device changes from light/dark mode in my SwiftUI app. The error below shows on every line where "

SwiftUI Navigation Title Text Priority (of two texts)

I have two texts that I would like to display in a navigation title: ... .navigationTitle(Text(getTitle()) + Text(" (\(selection + 1)/\(sequenceObject.h

SwiftUI: Get sidebar isCollapsed state on macOS

I'm using a NavigationView to create a sidebar on macOS. I can toggle the sidebar using this code: Button { NSApp.keyWindow?.firstResponder?.tryToPerform(

SwiftUI - List Line Separator Inset like iOS Settings App

I'm trying to achieve the behavior that's also seen in in the iOS Settings App or for instance the Roborock App (see screenshots below). I'd like to go for an I

SwiftUI Custom List Cell - disable horizontal padding/shrink in EditMode

I'm trying to create a custom List cell in SwiftUI, where the drag-icon in Edit Mode stays inside the cell. By default, the cell gets horizontally shrinked do m

use Firestore model value as toggle to present fullscreen view in SwiftUI

I have two screens in a SwiftUI app. Screen A is displayed after the app launch and contains a button which will update the value for currentWorkoutID on the us

SwiftUI Preview crash with await async iOS15 if returns a struct with UUID

I reduced to very simple code. If the struct has a Int is working, if there is an UUID the preview is crashing (it's working if I run on the simulator or real

Add top shadow to TabView in SwiftUI

I have the following: I'm using a native TabView. I can change the background but I haven't been able to add a little shadow to the top of the UITabBar, I've t

Dynamically add textfields with a for each loop and a button in swiftUI

I am trying to use a ForEach loop to dynamically add textfields inside a form section with a button. Form { ForEach(0..<numberOfItems, id: \.

`Task` blocks main thread when calling async function inside

I have an ObservableObject class and a SwiftUI view. When a button is tapped, I create a Task and call populate (an async function) from within it. I thought th