Category "swiftui"

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

SwiftUI - How to pass EnvironmentObject into View Model?

I'm looking to create an EnvironmentObject that can be accessed by the View Model (not just the view). The Environment object tracks the application session da

How do I render a SwiftUI View that is not at the root hierarchy as a UIImage?

Suppose I have a simple SwiftUI View that is not the ContentView such as this: struct Test: View { var body: some View { VStack {

Swiftui - How do I initialize an observedObject using an environmentobject as a parameter?

I'm not sure if this is an antipattern in this brave new SwiftUI world we live in, but essentially I have an @EnvironmentObject with some basic user information

Mutable Binding in SwiftUI Live Preview

I have a ChildView with a variable: @Binding var itemName: String In this ChildView I have few buttons that change value of the variable: Button(action: {

SwiftUI - navigationBarBackButtonHidden - swipe back gesture?

if I set a custom Back Button (which everyone wants, hiding the ugly text ;-) ) and using .navigationBarBackButtonHidden, the standard Swipe Back gesture on the

Function opaque return type was inferred as ... which defines the opaque type in terms of itself

Xcode gives the error: Function opaque return type was inferred as 'Button', which defines the opaque type in terms of itself on the line below: @State var sh

Mimic the iOS Photos APP browsing behavior with SwiftUI

I am new to SwiftUI (iOS development). I would like to mimic the iOS Photos APP browsing behavior with SwiftUI. More specifically, I want to display a photo in