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.
swift
334,592
questions
0
votes
0
answers
12
views
Hashing files leads to GB of memory trail
I’m iterating a file tree, storing URL's and hash values as Integer in an array of tuples.
Creating file hashes leads to a 6GB memory trail for about 38 thousand files. Without its about 36Mb. ...
0
votes
0
answers
8
views
Stop NaviationLink overriding DisclosureGroup ontap gesture
I have the following SwiftUI view:
import SwiftUI
struct ContentView: View {
var items = [1, 2]
var body: some View {
NavigationStack {
List {
ForEach(self....
0
votes
0
answers
10
views
SwiftUI Master-Detail View: How to remove the gap between back-button and content?
I have made a master-detail view using NavigationStack and NavigationLink.
The detail-view looks currently this way:
The code of the DetailsView:
struct FullArticleView: View {
var article: ...
0
votes
1
answer
23
views
How to detect a change in the value of “editMode” from a toolbar?
Let's use a selectable List as follows:
import SwiftUI
struct ContentView: View {
@State private var elements: Set<UUID> = [.init(), .init(), .init()]
@State private var selection: Set&...
0
votes
0
answers
26
views
Network warning: "Connection has no local endpoint"
I have a simple SwiftUI application that sends a URLRequest as shown in the code snippet below:
import SwiftUI
@main
struct GOGODemoApp: App {
var body: some Scene {
WindowGroup ...
-2
votes
1
answer
29
views
Why isn't CADisplayLink Sendable?
I'm looking at the this SoF answer and when I tried it out, I got the warning:
Non-sendable type 'CADisplayLink?' returned by implicitly asynchronous call to nonisolated function cannot cross actor ...
1
vote
1
answer
25
views
iOS Firestore permission denied even when using Firebase Authentication
I know this question has been asked a lot but a lot of the solutions say to change the Firestore rules and I don't want to do that. I'm wondering why they aren't working as is since I have ...
-1
votes
0
answers
35
views
Why doesn't NSDateFormatter work as expected?
I've gotten some really strange results from the date formatter:
let testDate = Date(timeIntervalSinceReferenceDate: 725840000.0)
print(testDate)
2024-01-01 22:13:20 +0000
let fmt = DateFormatter()
...
-1
votes
1
answer
16
views
Transfer gestures to view on other UIWindow?
I have a set-up in my iOS app where I have two UIScreens (and thus two UIWindows) - one on the device, and the other on an external display.
I want the user to be able to make a gesture on their ...
0
votes
1
answer
27
views
Loading View animation don't work as needed in SwiftUI
I created this animation depending on a Boolean value to show as a loading animation. I wanted it to blink only in the middle of the view but it enters the view from top left hand corner, comes into ...
0
votes
0
answers
17
views
SwiftUI paging with custom scrolling control
I'm new to SwiftUI, and I'm trying to design a paging view associated with a custom tab bar control. The tab bar should be scrollable and synced with the main view. Tap to select on the tab bar should ...
0
votes
1
answer
24
views
Why won't a SwiftUI Slider trigger a change to a small range?
I am trying to make a slider update a value if it changes. In this case, I'm looking for a lower and upper bound in a range from 0 to 4. If the min value is greater than the max value, I want the max ...
-1
votes
0
answers
18
views
Can't get tasks to save [closed]
I just finished a video tutorial on building a to-do list app but I can't get the tasks to save. I followed the video and made sure my code's correct so I have no idea what's causing the issue.
When ...
-1
votes
0
answers
26
views
When using NSBezierPath in Swift (Xcode 12), "fill" is not controlled by the "path"
I want to fill outlines I construct using NSBezierPath and its methods "move" and "line". The "stroke" method clearly shows that the path exists as I intended. However, ...
0
votes
1
answer
21
views
Specifying Item Spacing in UICollectionLayoutListConfiguration
Currently, I am using UICollectionViewCompositionalLayout to achieve the following list layout with spacing:
We were thinking of trying out UICollectionLayoutListConfiguration due to its ability to ...