Category "swiftui"

SwiftUI custom accentColor not working on physical device(iOS 13) but works everywhere else(iOS 14.0+)

In my SwiftUI View I've an Image that I've loaded from assets. I've set the foregroundColor to accentColor, which I've also set in asset as my custom AccentColo

Preview not changing device to iPhone SE when using SwiftUI

I am new to SwiftUI and I was trying to change my preview device to iPhone SE but the device does not change. When I update the text "Hello, world!" to somethin

Align Items in swiftUI Stack Evenly

How can the items in a swiftUI Stack be aligned evenly to fill up all the available space? The first and last item should be straight at the beginning / end of

SwiftUI Navigation popping back when modifying list binding property in a pushed view

When I update a binding property from an array in a pushed view 2+ layers down, the navigation pops back instantly after a change to the property. Xcode 13.3 be

How to add test data to PreviewProvider

I am new to iOS/Swift and to the MVVM architecture and was wondering how to send in test data to the SwiftUI Preview. (Actual data is received from the ViewMode

How to create a custom delete button without using the slide to delete that comes with swiftUI I am not using list, just using a foreach loop

Since, the onDelete and onMove are features of List/form I cannot use them when I have custom interfaces without them. I have used a VStack inside a ForEach. I

How to make a view between Spacers always at the center in an HStack?

What I would like to achieve. regardless the width of text width at both side the button should always at the center of the HStack. HStack { Text("Fooooooo

How to call a function on original view when modal view is dismissed

I have a SwiftUI puzzle game. I store played puzzles and show in the history view. History view is displayed as a sheet when a button is tapped. In the history

SwiftUI 2.0 CoreData issues with new project - 'Cannot find type 'Item' in scope'

[EDIT] I was hoping that Apple would have fixed what is obviously a bug. The solution is to clear the cache, close and reopen Xcode.. I am on Xcode Beta and sta

Accessing AppState in AppDelegate with SwiftUI's new iOS 14 life cycle

I'm using SwiftUI's new app lifecycle coming in iOS 14. However, I'm stuck at how to access my AppState (single source of truth) object in the AppDelegate. I ne

Hosting Controller When Using iOS 14 @main

I’m experimenting with a “pure” SwiftUI app. It doesn’t have a SceneDelegate so I’m unsure of where to put Hosting Controller stuf

I am getting an error called "Argument passed to call that takes no arguments"

I am following the ios app development tutorial for the Scrumdinger app and I have followed the tutorial and it has worked until I finished the Passing Data wit

SwiftUI 2.0 List with children - how to make the tappable area of the disclosure button cover the whole list item

I am making a SwiftUI app for iOS 14, and I have a sidebar list that uses the new children: attribute of list to make the list expandable: However, at the momen

Jumpy toolbar items in NavigationView

I tried to use a custom view as the navigation title inside a NavigationView. Every time when the detail view is popped up, the toolbar items are always resized

cornerRadius on message SwiftUI

I'm having this problem that my messages don't have corner radius on the other side. This is how it looks: And there is the code for it: HStack { HStack {

Change background color of TextEditor in SwiftUI

TextEditor seems to have a default white background. So the following is not working and it displayed as white instead of defined red: var body: some View {

UITabBar containing SwiftUI View

I have the below series of controllers and views. However, when I use the navigation link on the MoreView it changes the tabBarItem.title value. For instance it

SwiftUI set corner radius depending on its own height

When I set corner radius with constant value, depending on the size of the image, the results don't come out the way I want. Image(“myImage”) .c

SwiftUI app doesn't run when supporting iOS 13

App was working fine when the deployment target was 15.2, but then I needed to change the deployment target to iOS 13 to support more devices. Still works fine

Programmatically change to another tab in SwiftUI

I'm trying to implement in SwiftUI where you press a button in a view on one tab, it changes to another tab. I would do with UIKit: if [condition...button press