Category "swiftui"

Failed to find a unique match for an NSEntityDescription CoreData Swiftui

When I use my app, sometimes, I have an error that appear, it seems to be randomly (or I didn't figure out when exactly...), then all my lists are empty (like i

Transparent TabBar when popping Child NavigationView iOS 15

I have a SwiftUI application with a TabBar. If I open a detail child view from a NavigationView, and then click on "Back", the TabBar would become transparent,

Navigation stuff in SwiftUI

I'm trying to figure out how to use the navigation bar in SwiftUI I want to put BarButtonItem and images inside the NavigationBar I have been able to display

SwiftUI NavigationButton without the disclosure indicator?

When making a List with a row that pushes to a new view, SwiftUI adds a disclosure indicator ">" automatically? How do I remove it if I don't want it? N

How to detect a tap gesture location in SwiftUI?

(For SwiftUI, not vanilla UIKit) Very simple example code to, say, display red boxes on a gray background: struct ContentView : View { @State var points:[C

What does the dollar sign do in Swift / SwiftUI?

This tutorial by Apple about SwiftUI uses a dollar sign to bind data, and I‘m having trouble finding more information about this data binding in SwiftUI.

Center View horizontally in SwiftUI

How can I center horizontally a View (Image) in an HStack? I want a button to be left aligned and the image to be centered horizontally the view. Currently I ha

Xcode Canvas for SwiftUI previews does not show up

I´m trying to get the new Canvas feature from Xcode 11 running, but the Canvas won´t show up. What am I doing wrong? This new Xcode feature should s

SwiftUI Double Backslash in Text without Raw Strings

In SwiftUI how can i make Text to show Double Backslashes? Escaping does not seem to help Text("Hello \\\\") // renders to: Hello \ Expected Output: Hello \\ R

SwiftUI: Broken explicit animations in NavigationView?

When I put an explicit animation inside a NavigationView, as an undesirable side effect, it animates the initial layout of the NavigationView content. It gets e

How to use UIApplicationDelegateAdaptor as ObservableObject?

In my iOS 14 App, I can register the legacy AppDelegate by doing this: @main struct MyApp: App { #if os(iOS) @UIApplicationDelegateAdaptor(AppDeleg

SwiftUI Localize Raw Strings

In SwiftUI how can i get my raw string localized? Text(#"Hello \\\\"#) Adding this to the localized file will not work. "Hello \\\\" = "is not translated \\\\"

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