Category "swiftui"

How to get Text width with SwiftUI?

I would like to underline a title with a rectangle that should have the same width as the Text. First I create an underlined text as below: struct Title: View

SwiftUI Drag and Drop files

I am trying to add a "Drag and Drop" gesture / function to my SwiftUI Mac application. I want to drop files from my System/ Desktop into my Application. It is

SwiftUI rotation animation has unexpected translation [duplicate]

I'm trying to animate a spinning "busy" image in a SwiftUI View using standard and consistent online tutorials. The image is square, should b

SwiftUI UIView with Overlay cancels touch

I am stuck on this UI issue, working with SwiftUI and UIView. Basically, overlay stops user interaction to follow through to the UIView. Button(action: { pri

SwiftUI List inside ScrollView

I want to make my List inside a ScrollView so that I can scroll List rows and headers together. But I found that List inside ScrollView isn't working. It shows

How to change DatePicker's texts color in SwiftUI?

I saw this question but it doesn't work in SwiftUI. Changing text color of datepicker I tried .forgroundColor and .accentColor but they don't change the texts

How to access own window within SwiftUI view?

The goal is to have easy access to hosting window at any level of SwiftUI view hierarchy. The purpose might be different - close the window, resign first respon

SwiftUI - How to close the sheet view, while dismissing that view

I want to achieve the function. Like, "Look up" view that is from Apple. My aim is when the sheet view push another view by navigation, the user can tap the na

NSWindow contentView not cover full window size - macOS & SwiftUI

I'm starting a new macOS app with SwiftUI but I have a big problem. The app needs a full size contentView (underneath titleBar) but I can't accomplish. On a new

SwiftUI: prevent View from refreshing when presenting a sheet

I have noticed that SwiftUI completely refresh view when adding sheetmodifier. Let's say I have View that displays random number. I expect that this value wou

How can I customise the Animation of an Angle change in SwiftUI

I have an app that shows a bunch of people who each have an origin and angle. struct Location { var centre:CGPoint var facing:Angle } SwiftUI magical

SwiftUI: how to create custom UIDatePicker?

I succeeded to create UIDatePicker inside SwifUI, but when I change the date wheel in picker the date value not update, here is my code: struct DatePicker: UIVi

How can I display my user custom data in String format?

I'm new to Swift UI and MongoDB Realms. I'm trying to display a user's email (from their respective custom user data) in a text box but I'm getting a weird resu

SwiftUI: observe @Environment property changes

I was trying to use the SwiftUI @Environment property wrapper, but I can't manage to make it work as I expected. Please, help me understanding what I'm doing wr

Add Stripe Credit Card without Payment in SwiftUI

I am struggling to find a solution that isn't UIKit, or one that requires you make a purchase. My project is trying to integrate Stripe in SwiftUI, using node.j

RealityKit – Difference between loading model using `.rcproject` vs `.usdz`

I'm building a simple app that adds a hat on top of the user's face. I've seen examples of 2 different approaches: Adding the object as a scene to Experience.rc

SwiftUI Picker SegmentedStyle Image bad display

I have a simple Picker in SegmentedStyle with two images inside: @State var selectedIndex = 0 @State var segmentOptions = [ Image.carFill, Image.walkin

SwiftUI add inverted mask

I'm trying to add a mask to two shapes such that the second shape masks out the first shape. If I do something like Circle().mask(Circle().offset(…)), th

SwiftUI: how to detect when List is scrolled? [closed]

I have a view with a search bar at the top and a SwiftUI List below. I need to detect when the List is scrolled so I can dismiss the search ba

Use Binding<Int> with a TextField SwiftUI

I am currently building a page to add player information to a local database. I have a collection of TextFields for each input which is linked to elements in a