Category "swiftui"

HTML-like table layout (i.e. auto-resizing table cells) in SwiftUI View?

I’d like to render a table of text cells in my SwiftUI View in a way, that every cell auto-resizes just so much that the text fits in it. So I did this:

Observe window resize event with SwiftUI

I currently have a LazyVGrid setup as such: struct NetworkGrid: View { var networks: [Network] let columns = [ GridItem(.flexible()),

Make Line chart gradient color go from line to bottom - SwiftUI

I am trying to make it so the line chart display a gradient color from the line and down but I can't seem to get it to only go from the line. Instead it just fi

Can't select a folder with UIViewRepresentable & UIDocumentPicker

I'm trying to create a picker for a user to choose a folder in a SwiftUI app. However, there doesn't seem to be any SwiftUI document picker yet so I was attempt

tracking down/working around UnsafeRawBufferPointer with negative count (presumably somewhere out of SwiftUI intestines/Swift runtime)

What do I do about this? I get no useful info predictably. A search for UnsafeMutablePointer yields func scrollViewWillEndDragging(_ scrollView: UIScrollView,

Is this the proper way to use PHPicker in SwiftUI? Because I'm getting a lot of leaks

I am trying to figure out if my code is causing the problem or if I should submit a bug report to Apple. In a new project, I have this code: ContentView() impor

Can I hide the text of the Sign In with Apple button? (a.k.a ASAuthorizationAppleIDButton)?

I am implementing Sign In with Apple on my iOS app (SwiftUI). In SwiftUI, I can use the 'SignInWithAppleButton' (https://morioh.com/p/524e0408008c), this button

Center Image in VStack leading alignment

I'm having troubles figuring out the proper solution to centre an Image inside a VStack with an alignment of .leading. I've attempted and got these results but

swiftui, animation applied to parent effect child animation(Part II)

PREVIOUS Q: swiftui, animation applied to parent effect child animation Now the TextView has its own state. RectangleView with TextView slide into screen in 3 s

onDelete causing NSRangeException

In this app, there is a main screen (WorkoutScreen) that displays the contents of a list one at a time as it iterates through the list (current workout in a lis

How to make a SwiftUI NavigationLink conditional based on an Optional Object?

Let’s say I have a model class Ball, that conforms to the ObservableObject protocol, and I define an optional instance of it (var ball: Ball?). Is there a

Recognize changes in SwiftUI TextField with double value

I am using a TextField to let the user add a price for something. To prevent the user adding other values as a number, I change the keyboard type to .decimalPad

SwiftUI dismissing view by setting NavigationLink tag to nil

I'm trying to implement the logic of programmatic view pop in SwiftUI I set a tag on the items and create a corresponding variable for the selected item, but wh

SwiftUI TabBar: Action for tapping TabItem of currently selected Tab to reset view

The app I am working on is based around a TabBar, and when I am on a tab I want to be able to click the tabItem again to reset the view, similar to how Twitter

How can I have a Blur effect as a Background in SwiftUI?

I want to have blur effect as background for my View, as we know, we can blur the view and what is inside, but I do't want blur content of view but I want blur

Pass data from ViewController to Representable SwiftUI

I am doing an object detection and used UIViewControllerRepresentable to add my view controller. The thing is that I can't pass data from my ViewController to m

iOS Document Picker crashes when picking a PDF on a real device

I try to create a Document Picker for my iOS app. Here is my code (I wrapped the UIDocumentPickerViewController in my SwiftUI View, with UIViewControllerReprese

SwiftUI - How to deinit a StateObject when navigating back?

I want my @StateObject to be deinitialized as soon as possible after I navigate back, but it seems that the object is held in memory. "Deint ViewModel" is not b

SwiftUI ViewModifier for custom View

Is there a way to create a modifier to update a @State private var in the view being modified? I have a custom view that returns either a Text with a "dynamic"

Make List Sections non-collapsible in SwiftUI when embedded into a NavigationView SwiftUI

When I embed a List grouped into Sections into a NavigationView the section headers become collapsible. I'd like to keep them non-collapsible, just like when th