Category "swift"

RealityKit – Get ModelEntity Size as SIMD3<Float>

Is there anyway to know the size of the ModelEntity as SIMD3? Once, I get the size, I want to pass it to the CollisionComponent. let box = ModelEntity(mesh: Me

Sheet inside ForEach doesn't loop over items SwiftUI

I have an issue using a sheet inside a ForEach. Basically I have a List that shows many items in my array and an image that trigger the sheet. The problem is th

SF Symbols Hierarchical, Palette, and Multicolor rendering mode colors?

At WWDC 2021 Apple announced SF Symbols 3, which will support new multi-color SF Symbols in iOS 15 and macOS 12. New color-rendering modes that add depth and e

AVFAudio - Is it safe to perform file copy immediately after AVAudioRecorder.stop()

We start a voice recording via self.avAudioRecorder = try AVAudioRecorder( url: self.recordingFileUrl, settings: settings ) self.avAudioRecorder.record

How to use completion block for UIView.animate()?

I'm working on a project to learn animations and am having trouble using the completion block for the UIView.animate(withDuration:) func. MY animation is a shoe

Core data - TableView - Toggle - Index out of range

I have a data model like this. The data is connected to core data. import Foundation import CoreData @objc(Aktie) class Aktie: NSManagedObject { @NSManaged

Interacting with the view controller behind

I know there are several posts on SE relating to this issue but I couldn't get around them to find a proper solution for my situation. I've a map view inside a

How to retrieve PHAsset from PHPicker?

In WWDC20 apple introduced PHPicker - the modern replacement for UIImagePickerController. I'm wondering if it's possible to retrieve PHAsset using the new photo

How to send an array of JSON object as a parameter value in request body ios swift

Hello I'm using Invoice generator api JSON Input https://invoice-generator.com/developers#json-input In the documentation of the API it is mentioned that the it

SwiftUI | Using onDrag and onDrop to reorder Items within one single LazyGrid?

I was wondering if it is possible to use the View.onDrag and View.onDrop to add drag and drop reordering within one LazyGrid manually? Though I was able to make

SwiftUI - 2 Handle Range Slider

Is there a way, using SwiftUI, to create a Slider with 2 handles? I'm working on a project that that requires settings a low and high point for a random value t

Unit Testing Combine

I'm having difficulties testing Combine. I'm following: https://www.swiftbysundell.com/articles/unit-testing-combine-based-swift-code/ Which tests: final class

How to exclude UIViewControllers other than views from Swizzle Method?

I am trying to override viewDidAppear() methods of my custom ViewControllers and i found a solution using swizzle method. It works but when keyboard is visible,

MacOS swift: having trouble in obtaining output data from Pipe()

I am trying to run command lines to take screenshots in my Xcode project and using Pipe() to log output data. When I build and run this project in Xcode, I can

In SwiftUI what is an easy way to align more than one view in ZStack

I have a view and I want to add two icons to it, at top right side and at bottom right side. I managed to do that: I used two ZStacks: ZStack(alignment: .botto

SwiftUI - Firebase Apple Auth not authenticating

im fairly new to swiftUI... pardon the ignorance :) I have most of the code entered in my project from the instructions on the Firebase website. For some reason

Enable SwiftLint only for the new files

I have a pretty huge iOS(legacy) project in which I want to add SwiftLint. All the rules I wish to enforce, I would enforce only on new created files. In that w

.onReceive do not work when @Published property is changed [duplicate]

I have a @Published property in ViewModel and .onReceive in View. When my @Published var changes the .onReceive is not even executed. View is

UITextView - limit amount of characters per line

I have a UITextView and I want to line break each time a user is extending a limit of chars per line (let's say 30 chars per line is the maximum). And I want to

How to change title Color? swift 5

I can't change title color, which is white by default and when my background color is white too, it's invisible. How can i change it to the black color? enter i