Category "swift"

Create dictionary from an array of objects using property of object as key for the dictionary?

With Swift is it possible to create a dictionary of [String:[Object]] from an array of objects [Object] using a property of those objects as the String key for

static let sharedInstance not accessible from Objective-C code

Problem: The declared static let sharedInstance is not accessible from Objective-C code when building the main app target. Code: @objc public protocol Manag

Swift ui macOS popover on the button or on an image

I wish I could do such a thing as seen in the image. I'm trying to use this piece of code but I'm not quite understanding how to fix it. I wish I could use it

Remove objects with duplicate properties from Swift array

The question here involves removing duplicate objects from an array: Removing duplicate elements from an array in Swift I instead need to remove objects that

3D artwork that is exported as USDZ has different colors

I want to start by saying that I am new to SceneKit and playing with AR environments on iOS. I have a 3D model object, a van, as part of a Blender file(.blend)

How do you share a data model between a UIKit view controller and a SwiftUI view that it presents?

My data model property is declared in my table view controller, and the SwiftUI view is modally presented. I'd like the presented Form input to manipulate the d

SwiftUI Word Wrap for multiline text Word Hyphenation Problem

I'm facing the following problem with SwiftUI Text: In the following example SwiftUI breaks the word "Amazement" into "amazeme" on the first line and "nt" on th

RealityKit – Adding ModelEntity to an ARGeoAnchor

I am in USA (Houston, TX) and I am trying to add a ModelEntity in RealityKit to a specific geo location. But I am not able to see the entity anywhere. Am I doin

Setting tableHeaderView height dynamically

My application creates a UITableViewController that contains a custom tableHeaderView which may have an arbitrary height. I've been struggling with a way to set

Limit rectangle to screen edge on drag gesture

I'm just getting started with SwiftUI and I was hoping for the best way to tackle the issue of keeping this rectangle in the bounds of a screen during a drag ge

How to add the AppTrackingTransparency permission to your iOS apps

I am extremely new to iOS, with no iOS development experience at all, however, I've been given a task that's related to preparing for iOS 14+. Based on what I'v

NSPredicate with multiple arguments and "AND behaviour"

I have a function which fetches those objects from a particular entity that fulfill a specified criterion: func fetchWithPredicate(entityName: String, argument

ReSwift and State with a reference type property

Since ReSwift is based around immutability of State, the Swift struct is obvious choice to work with. But what if I really need a reference type property in a

Google sign I didSignInFor. I am getting ID Token expired

I using google with sign in. From today morning, google sign in was not working. Not sure why its happening. I am getting error : ID Token expired On my consol

How to add image on UITableView delete button?

I have an UITableView and I've added edit actions to it. Now I want to add image above the delete buttons label, as: This is my code: func tableView(tableVi

Select/deselect buttons swift xcode 7

Part way done with learning swift but I hit a small wall and yet again, I'm sure I'm just a bit new at this and an easy solution is there but I'm having trouble

Any easier to read run-length Encoding in Swift?

Can anyone write run-length encoding code in swift that is easier to read than the one below or at least explains the one i got from rosettecode.org ? Here is t

What does animatableData in SwiftUI do?

I was playing around with the animatableData property for a custom Shape I made but I couldn't really visualise what it does and where the system uses it. I did

SwiftUI custom list with ForEach delete animation not working

I am creating a custom list displaying time information (minutes and seconds, not used in the snippet below to simplify the code). I managed to implement a nice

How to make a UILabel clickable?

I would like to make a UILabel clickable. I have tried this, but it doesn't work: class DetailViewController: UIViewController { @IBOutlet weak var tripD