Questions tagged [swift]

Swift is a general-purpose programming language developed by Apple Inc first released in 2014 for its platforms and Linux. Swift is open-source. Use the tag only for questions about language features, or requiring code in Swift. Use the tags [ios], [ipados], [macos], [watch-os], [tvos], [swiftui], [cocoa-touch], and [cocoa] for (language-agnostic) questions about the platforms or frameworks.

0
votes
0answers
4 views

iOS - Swift - Leetcode | HOW to make LRU cache thread safe?

I just solved the LRU cache on Leetcode with dictionary and double linked list. However I saw some companies ask following up questions: How to make it thread safe. So my question is: How should I ...
0
votes
0answers
6 views

Swift Firestore returning empty array

I am getting an empty array back from firestore. Specifically from the sub model "Coor" inside of "EventModel". Data Model: struct EventModel: Identifiable, Codable { var id: ...
0
votes
0answers
7 views

Crop Image to fit view

A thorny problem that I've spent days trying to figure out, please help. Problem: I'm trying to implement a feature similar to social media app snapchat: Their image preview view extends past the ...
0
votes
0answers
8 views

SwiftUI - GeoFire removeObserver Not Working, seeking for workaround please

I find out that both removeObserver and .removeAllObservers() is not working in GeoFire, hoping another work around to "get out" of this observe (which keeps loading forever) var ...
0
votes
0answers
9 views

CIFilters [CICategoryColorEffect] in swift

BACKGROUND I am working on project that provides custom filters to users. I am using core image. ISSUE I want to implement all filters provided inside CICategoryColorEffect and facing issue in passing ...
0
votes
1answer
17 views

Prevent Text View from changing width and position when updating in an HStack

I'm following a SwiftUI tutorial and have made this view that updates with data when a user drags or zooms into an image. After I detoured from the tutorial to round these strings to the nearest ...
0
votes
0answers
6 views

Scenekit Node not moving

I have a sceneKit application with 2 .scn files in the art.scnassets folder. The base "ship.scn" that comes with the project, and a new file "orcIdle.scn" that I added myself. When ...
0
votes
0answers
16 views

TabView on watchOS does not display tab bar item text

This is a related question: Cannot use TabView on SwiftUI, WatchOS However, I am running TabView on watchOS 7.0+ but it is not displaying the tab item text. Is there a way to display the title or ...
0
votes
1answer
16 views

Swift sorting Relationship in CoreData

I would love to get help on this one since I've been on it for a while. So I fetch my Sections like this and they all get in the right order, but the relationship "Todoitem" they have do not ...
0
votes
2answers
26 views

Get current date and time in Swiftui [closed]

I am trying to get the current time in hours for my app in Xcode 13.2 (Monterey) and for something that should be working, I keep getting an error and I can't figure out why This is simple code I'm ...
0
votes
1answer
42 views

Get x amount of initial digits in a long Number

I have some numbers coming from the api like this: 0.0000000092726851369802 How can I get the index (which can change) of the last 0 before the 9 and from there count 4 and return those numbers? So it ...
0
votes
0answers
20 views

I'm racking my head and can't figure out why I'm getting No value associated with key CodingKeys error

I've been racking my head for the last day trying to figure out why I'm getting the error below. I've tried changing from an array to a dictionary and no luck. failure(Swift.DecodingError.keyNotFound(...
1
vote
1answer
17 views

SwiftUI, how to remove gray rectangle created by default with a Button?

I am running macOS 12.1, Xcode 13.2 and learning SwiftUI (Swift in general). Xcode defaults have been restored, Clean Build Folder applied. I don't understand how to make this grey rectangle disappear....
0
votes
0answers
13 views

How can I draw an infinity line in Path?

I know how I can use addLine() to draw a line in a path, I am looking to draw a line that use those 2 points, like this image: As you can see, there is a blue point and then a green point, normally ...
0
votes
0answers
7 views

XIB in resource bundle cannot access Swift class outside of the bundle

My framework's XIB uses custom view classes and it cannot access these files because Cocoapods bundles them separately. Podspec example: s.source_files = 'TheFramework/**/*.{swift}' s.resource_bundles ...

15 30 50 per page
1
2 3 4 5
20549