Category "swiftui"

Padding HStack in the top of any screen

I want to put an HStack which contains two Texts in the top of any device screen. the problem is when I use padding that I have to decide fixed size of padding.

Property wrappers and SwiftUI environment: how can a property wrapper access the environment of its enclosing object?

The @FetchRequest property wrapper that ships with SwiftUI helps declaring properties that are auto-updated whenever a Core Data storage changes. You only have

SwiftUI Toolbar item getting clipped when back button is pressed

I've run in to a strange behavior in SwiftUI that I can't seem to work around. Given the following simple example app I experience this behavior: The toolbar it

SwiftUI TextField doesn't commit change when tapping another TextField

I am building some basic form functionality in my app at the moment and I am having trouble with TextFields not changing the value in the relevant binded variab

Difference between creating ViewModifier and View extension in SwiftUI

I'm trying to find out what is practical difference between these two approaches. For example: struct PrimaryLabel: ViewModifier { func body(content: Conte

Swift: task {} before iOS 15?

I am following tutorials to understand SwiftUI, and specifically how to call an API when a view appears. I saw this: List(results, id: \.trackId) { item in

WheelDatePicker is invisible in iOS 15.0

I'm building an app in SwiftUI that needs DatePicker in the custom alert. Each time I use DatePicker with a WheelDatePickerStyle, it is invisible in IOS 15.0 (a

Xcode Preview Resume Button Shortcut

Is there a keyboard-shortcut to click the resume button in the canvas on Xcode Previews, instead of clicking it every time?

Newbie SwiftUI Nested array

Please help me display my model data from api I have a nested json data response and Have a swiftui model as below ****************************MyData model stru

In SwiftUI, where are the control events, i.e. scrollViewDidScroll to detect the bottom of list data

In SwiftUI, does anyone know where are the control events such as scrollViewDidScroll to detect when a user reaches the bottom of a list causing an event to ret

How to remove highlight on tap of List with SwiftUI?

How to remove highlight on tap of List with SwiftUI? List { }.whatModifierToAddHere? The selection manager documentation doesnt say anything about it.

Getting the result of input from one view to another SwiftUI [closed]

I have this view: struct CreateBoardView: View { @State public var BoardName: String = "" var body: some View { ZStack {

What is the "some" keyword in Swift(UI)?

The new SwiftUI tutorial has the following code: struct ContentView: View { var body: some View { Text("Hello World") } } The second line the

TextField in Table behavior

I'm trying to use the new SwiftUI Table with TextField's in each row. However, the behavior of the text field's is weird, for 3 reasons: Clicking on a text fiel

SwiftUI's keyboardShortcut is not working if Button has a buttonStyle

My code: Button(action: { AudioServicesPlaySystemSound(1026) isActive.toggle() }){

WidgetKit not work for an Intent Handler to Provide Dynamic Values

I am trying to implement a widget where the user can choose a city dynamically via an intent. I followed the step by step guide provided by apple here: https://

LazyVGrid inside a VStack inside a ScrollView among other elements causes a crash

Here's my view's code: ScrollView { VStack { someView LazyVGrid( columns: [ GridItem( .adap

How can I set the Dragging Image in SwiftUI on macOS

I am trying to change the preview image for drag and drop from the default for a GridView which seems to include all the visible items in the grid. As I underst

MapAnnotation, how can we decide the zIndex of an Annotation?

when using the MapKit.Map to display multiple Annotation overlapping, everything works properly whether you use MapPin, MapMarker or MapAnnotation. The tricky p

SwiftUI - menu not appearing and double toolbar for NavigationView

I am creating a iOS app with XCode. All source code has been written and compiled. The app runs in the iOS simulator. The user interface was created in SwiftUI