Category "swiftui"

3D artwork that is exported as USDZ has different colors

I want to start by saying that I am new to SceneKit and playing with AR environments on iOS. I have a 3D model object, a van, as part of a Blender file(.blend)

How do you share a data model between a UIKit view controller and a SwiftUI view that it presents?

My data model property is declared in my table view controller, and the SwiftUI view is modally presented. I'd like the presented Form input to manipulate the d

SwiftUI Word Wrap for multiline text Word Hyphenation Problem

I'm facing the following problem with SwiftUI Text: In the following example SwiftUI breaks the word "Amazement" into "amazeme" on the first line and "nt" on th

how to switch tab programmatically on button click? in swiftui

I have implemented tab bar in my code. I have see all button in my first tab and from that button i want to switch to second tab programmatically. When I use na

Limit rectangle to screen edge on drag gesture

I'm just getting started with SwiftUI and I was hoping for the best way to tackle the issue of keeping this rectangle in the bounds of a screen during a drag ge

How to make a SwiftUI DocumentGroup app without starting on the file picker?

If a user uses the Document App template in Xcode to create a SwiftUI app, macOS starts them off with a new document. This is good. I can work with that to pres

What does animatableData in SwiftUI do?

I was playing around with the animatableData property for a custom Shape I made but I couldn't really visualise what it does and where the system uses it. I did

SwiftUI custom list with ForEach delete animation not working

I am creating a custom list displaying time information (minutes and seconds, not used in the snippet below to simplify the code). I managed to implement a nice

How does one use NavigationLink isActive binding when working with List in SwiftUI?

The use case is pretty simple. I have a List of places, and each corresponds to a geofence. I need to enable navigation in that particular row(s) whose geofence

typealias LazyVStack for iOS 13

I have a SwiftUI app that I want to maintain iOS 13 support for, but on iOS 14 I want to use the new LazyVStack and LazyHStack. I was thinking typealias would b

How can I vertically align an image to the center of the first line of some text?

I have a bullet point and some long, multiline text. I want the bullet point to be aligned with the center of the first line of text. Obviously, If the string i

SwiftUI 2 - How to prevent the top section from closing in a list in macOS and iPadOS

In a SwiftUI 2 navigation bar I have a list with multiple sections. All sections have a header, however I want the top section to never be closed and the elemen

SwiftUI VStack and Spacer not behaving according to docs

In a SwiftUI Apple Watch app, we need some text aligned in a vertical scroll view such that: if the content is small, it should be placed at the bottom of the s

Offset doesn't reset after onTapGesture - SwiftUI

Im trying to create a card that slides when it is tapped on and then goes back to original position without tapping again the .onEnded() function of tap gesture

Not Receiving scenePhase Changes

I'm trying to execute some code I'd have previously put in my app delegate, such as saving my managed object context when entering the background. I put the ca

White flashing during orientation change even with black background SwiftUI

I have a ZStack that I set the color to black and then add a VideoPlayer. When I rotate the device there are still flashes of white around the player. I have pl

Button to open view in new window SwiftUI 5.3 for Mac OS X

I would like to have a button to open a new window and load a view (for the app's Preferences) in SwiftUI for MacOS but am unsure of the correct way to do it. I

SwiftUI can not add onChange event

I have a view in which I display a list of my messages. Whenever a new message is added I want to scroll to the bottom. I am trying to add an onChange event to

SwiftUI - how to change text alignment of label in Toggle?

Code for Toggle in SwiftUI is this: Toggle(isOn: $vibrateOnRing) { Text("Vibrate on Ring") } This will produce a toggle button with text label looking like

SwiftUI — Color.yellow renders as brown on iOS device (but yellow in simulator)

Why does Color.yellow appear brown on my iPhone X but yellow in my simulator? It's not a display problem, as this iPhone X screenshot of a test app shows: As y