Category "swiftui"

SwiftUI List is not showing any items

I want to use NavigationView together with the ScrollView, but I am not seeing List items. struct ContentView: View { var body: some View { Navigat

macOS SwiftUI Navigation for a Single View

I'm attempting to create a settings view for my macOS SwiftUI status bar app. My implementation so far has been using a NavigationView, and NavigationLink, but

How to detect keyboard events in SwiftUI on macOS?

How can I detect keyboard events in a SwiftUI view on macOS? I want to be able to use key strokes to control items on a particular screen but it's not clear how

Circle in SwiftUI doesn't show in my iPhone

I have two Circles to show a circle progress bar, one of these is the progress the another one is the background, but the progress circle doesn't show in my iPh

SwiftUI View not updating based on @ObservedObject

In the following code, an observed object is updated but the View that observes it is not. Any idea why? The code presents on the screen 10 numbers (0..<10)

SwiftUI - is it possible to get didSet to fire when changing a @Published struct?

I have just updated to XCode 11.4 and some of my code has stopped working. I have some @Published struct variables in an ObservableObject. Previously, when I up

SwiftUI Binding default value (Argument labels '(wrappedValue:)' do not match any available overloads)

In Swift you can define default values on a struct that can be overwritten on initialization: struct myStruct { var a: Int = 1 } var instance1 = myStruct()

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