Category "swift"

SwiftUI how to align the view‘s leading to the most super view’s leading?

I’m new to SwiftUI and I’m making a widget. The default code included a text view which is both x-centered and y-centered in the super view(which I

Toggle select / deselect state of a UICollectionView Cell on tap - Swift

So first of all i've been stuck on this for a few days and spent a full day reading and trying many options on Stack Overflow already but non to my success Wha

RealityKit – Text mesh resource performance warning

I have an object in RealityKit that I hover some text over. I make the text using the built in static function on MeshResource like this. let textMesh = MeshRes

How do you cache and retrieve swift packages using Azure Pipelines

I am trying to cache swift pacakages but I see a lot of examples doing the following below. This would only cache the package.resolved file but not necessarily

SwiftUI - How can I blur the default background color of a view?

no code to show here, but I would like to know how it may be possible to do this. I have tried to use .blur(radius: (20) on a view, but it tends to blur the

Get AVAudioPlayer to play multiple sounds at a time

I'm trying to get multiple sounds files to play on an AVAudioPlayer instance, however when one sound plays, the other stops. I can't get more than one sound to

SwiftUI UIApplication.shared.isIdleTimerDisabled = true just on one View

How can i turn Sleep off when just one View is Appeared ? UIApplication.shared.isIdleTimerDisabled = true stop the screen from going to sleep on every View. how

swift - Remove white spaces from var(UITextField input) doesn't work

I'm new to swift, but from ObjectiveC background, I tried to get an input from textfield into a var, on a button click. Now, when I tried to remove blank space

ARKit -[UIView setAnimationsEnabled:] Performing any operation from a background thread on UIView or a subclass is not supported

I have a ViewController that has a collectionView inside of it. I display the contents of the collectionView's cells inside an ARSCNView. When I set the ViewCo

How can I have onclick functionality for my CollectionView cells?

I want to make it so that when I tap on a CollectionView Cell, it segues to another view. I also want to pass a user ID to this view so I can query the database

SwiftUI + Dynamic action closure for Button

I am exploring SwiftUI and I was able to create a subclass of Button. The subclass contains image & title properties, which makes it a reusable component.

Is there an error prone way to exclude certain properties from struct during equality comparison without writting our own == function?

We like the auto equality behavior of struct, by just simply conform Equatable protocol. Sometimes, we would like to exclude some properties out from struct equ

Binding value from an ObservableObject

Aim: I have a model which is an ObservableObject. It has a Bool property, I would like to use this Bool property to initialise a @Binding variable. Questions:

CollectionView move to next cell automatically swift

I am trying to create horizontal slider like Flipkart. I am using collectionView with Horizontal scrolling and paging. Cell contains imageView. I am succeed in

How to send nested raw JSON in URLSession to Vapor API?

I have a Vapor API that has a route to register users. This route recibes a nested object in JSON format like this: { "name": "Test", "email": "test1@te

Error Domain=SSZipArchiveErrorDomain Code=-1 "failed to open zip file" UserInfo={NSLocalizedDescription=failed to open zip file}

_ = try? SSZipArchive.unzipFile(atPath: filePath, toDestination: downloadPath.absoluteString!, overwrite: true, password: nil, progressHandler: {

WKWebView open links from certain domain in safari

Within my app I am want to open links from within my domain (e.g.: communionchapelefca.org) in WKWebView but then have links from other domains open in Safari.

Connect to Postgres from Swift

In a Swift app, how does one connect to a Postgres database server? In Java, we use JDBC with an compliant driver to connect to a Postgres server, communicate

UIDocumentPickerViewController in SwiftUI on mac (macCatalyst)

So I've been meddling with "moving" a small SwiftUI iPad app to the Mac, and I've hit a bit of a speed bump with UIDocumentPickerViewController. I have wrapped

ld: Invalid value (Producer: 'LLVM13.0.0-rust-1.57.0-nightly' Reader: 'LLVM APPLE_1_1300.0.29.3_0') for architecture arm64

Trying to install and work with zkgroup. Build, run for specific iOS device working fine. But generic archiving is not working. Error text: ld: Invalid value (P