Category "swiftui"

Bluetooth keyboard input in Swift 5 SwiftUI app (versus UIKit)

I'm porting an iOS app from UIKit to SwiftUI. In this app, I need to capture and respond to keyboard input from a Bluetooth keyboard. In the UIKit app, I was do

Selection of nested CoreData List SwiftUI

Im trying to make my List selectable so I can delete or share multiple instances! Im trying to do that, with this method: List(selection: $selection) Here's my

Why is Xcode crashing when I try to preview?

Every time I am trying to resume my preview canvas in Xcode I get this annoying error. I tried restarting, moving the project to another location, and changing

State of an instance is not updating -- SwiftUI

So I have this structure Task which has a @State completion: struct Task:Identifiable{ var id: Int @State var completion:Bool = false var priority:S

How do I center an Image view in pdf format with SwiftUI?

I have a vector (converted to Pdf) that I want to use as my background for my app. However, the Image is aligned all the way to the left as you'd expect when us

Xcode is damaged and refuse to run the code

When I press "Build" and/or "Run" buttons in Xcode (SwiftUI), it shows me an error and I get this message: One of the paths in DEVELOPMENT_ASSET_PATHS does not

How can I access the subviews in SwiftUI?

I am trying our SwiftUI and want to create a component on the lines of SwiftUI's components. So, here is what I am trying to do: Create a new view extending Vie

SwiftUI DatePicker jumps between short and medium date formats when changing the date

(Using Xcode 12.3 and iOS 14.3) I use a DatePicker component with the default style (DefaultDatePickerStyle) to display and edit a date: the component shows the

Why primitive View in SwiftUI has no body?

The View protocol requires a body property: public protocol View { associatedtype Body : View @ViewBuilder var body: Self.Body { get } } Why have some

How to make a button (or any other element) show SwiftUI's DatePicker popup on tap?

I'm trying to achieve the simplest possible use case, but I can't figure it out. I have a picture of calendar. All I want is to show DatePicker popup when tappi

SwiftUI picker on macOS

I try for my personal knowledge to learn SwiftUI. Then I test on my Mac, but my first feeling is that SwiftUI is much more iOS oriented than macOS. Am I right ?

SwiftUI - MapAnnotation is showing up in wrong position

I am trying to display multiple map annotations to Apple Maps In SwiftUI, but the annotations are showing in some wrong perspective. All positions are displayed

Unable to call Device Activity in Screen Time Api From Parent Device

Using shared authorization I am able to authorize the child's device and able to see all the installed apps on the child's mobile on the parent device. But when

SwiftUI - Detect when ScrollView has finished scrolling?

I need to find out the exact moment when my ScrollView stops moving. Is that possible with SwiftUI? Here would be an equivalent for UIScrollView. I have no idea

How can you Drag to refresh a Grid View (LazyVGrid) in Swiftui?

How do you drag to refresh a grid view in swiftui? I know you can do it with List view with refreshable modifier in iOS 15, but how can you do it with a LazyVGr

Xcode 12 SwiftUI cannot find Automatic Preview

I am working on an app in SwiftUI in Xcode 12.2. I have accidentally deleted the Automatic Preview Tab. I cannot seem to find the option to bring it back. Here

Can't show image from url in swiftUI with URLSession [duplicate]

i'm new to swiftUI and trying to create simple app for showing images from API of images i got the images from url but can't show it in Imagev

SwiftUI TabView: how to detect click on a tab?

I would like to run a function each time a tab is tapped. On the code below (by using onTapGesture) when I tap on a new tab, myFunction is called, but the tabvi

SwiftUI - NavigationView title and back button clipped under status bar after orientation change

Whenever I rotate the device to landscape and back again, the top of the NavigationView (including the title and back button) get clipped under the status bar.

Create a share sheet in iOS 15 with swiftUI

I am trying to create a share sheet to share a Text, it was working fine in iOS 14 but in iOS 15 it tells me that "'windows' was deprecated in iOS 15.0: Use UIW