Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
1 vote
1 answer
94 views

Passing argument of non-sendable type '(any URLSessionTaskDelegate)?' outside of main actor-isolated context may introduce data races

I am using SwiftUI and I declared the View as @MainActor to resolve some of the concurrency warnings. However, I still get the warning Passing argument of non-sendable type '(any ...
smekers's user avatar
  • 13
0 votes
1 answer
102 views

How to convert AdMob `GADFullScreenContentDelegate` to Swift 6 concurrency

This is a similar problem to How to convert `VNDocumentCameraViewControllerDelegate` to Swift 6 Concurrency but one warning is new, so this may require different solution. I have the following code: @...
OMGPOP's user avatar
  • 1,308
0 votes
1 answer
75 views

How to convert `VNDocumentCameraViewControllerDelegate` to Swift 6 Concurrency

So I have this code: fileprivate class DocumentScanDelegate: NSObject, VNDocumentCameraViewControllerDelegate { static let shared = DocumentScanDelegate() var compressionQuality: CGFloat = 1 ...
OMGPOP's user avatar
  • 1,308
1 vote
1 answer
62 views

How to mark Vision text recognition result as Sendable in Swift 6

I have the following code. It simply run Vision API to get the text from the image. I use very simple GCD to dispatch the heavy Vision operation to the background queue, and then dispatch it back to ...
OMGPOP's user avatar
  • 1,308
2 votes
1 answer
279 views

Strict concurrency and Swift 6 produces error when trying to convert PhotosPickerItem to Data

I have the below view where I want to load an image from gallery using PhotosPicker and display it to the user. I also want to convert the image to Data so I can store it in SwiftData database. After ...
Robert Basamac's user avatar
0 votes
0 answers
44 views

NIO Event Loops and Swift async/await

I'm using swift-grpc which uses swift-nio under the hood. I'm having a hard time reconciling my understanding of Event Loops in the context of async/await. Using the following code as a reference: ...
bli00's user avatar
  • 2,531
2 votes
2 answers
169 views

mach_task_self_ is not concurrency-safe because it involves shared mutable state

I have a function that returns the memory use of a device. It uses mach_task_self_ which gives a warning that it is not concurrency-safe. task_info(mach_task_self_, task_flavor_t(TASK_VM_INFO), intPtr,...
Darren's user avatar
  • 10.2k
0 votes
1 answer
50 views

Execution of synchronously submitted work items on different threads in iOS

Are synchronously dispatched work items executed always on the main thread in iOS independent of anything (whether they are dispatched to a concurrent, serial, global, or custom queue)? I checked ...
jbalt's user avatar
  • 19
0 votes
0 answers
38 views

Intermittent Issue with Removing Snapshot View from MapView in iOS

I am facing an intermittent issue with removing a snapshot view from a MKMapView in my iOS app. The snapshot view is added to the map view as there was a white screen while the satelite view is ...
IMANUL SIDDIQUE's user avatar
1 vote
2 answers
141 views

Dangling pointer in concurrent read/write access to array

I am trying to understand what't wrong in my approach of access to array. In my app I got several not reproducible crashes with EXC_BAD_ACCESS KERN_INVALID_ADDRESS (some not 0 address). I suggested ...
Gomer Grek's user avatar
3 votes
2 answers
217 views

Possible concurrency issue with ForEach and array of @State

I added a screen recording below so the issue is even clearer. I'm struggling to understand why bindings (async) update differently when dealing with arrays, and much more reliably when dealing with ...
vullnetyy's user avatar
  • 1,629
0 votes
2 answers
373 views

Fixing warnings of non-conformance to "Sendable" for ImageResource in Swift 5.10

I have a file with some constants that maps enums to associated ImageResource for simplified usage in other places. Sample is below static let imagePreviews: [MyEnum: ImageResource] = [ .Enum1: ....
Ilja's user avatar
  • 45.8k
0 votes
1 answer
93 views

I need help structuring my data in my SwiftUI application. I have a mutating func in my struct but the "if let" mutates the copy and not original

I'm building a SwiftUI application and one of my Models has a mutating func that's purpose is to help update the UI when changes occur. For example, if a user updates their username I want to just ...
MobileFirst's user avatar
0 votes
1 answer
124 views

Hows does DispatchGroup().leave() function correctly across different threads?

I was reading this warning about releasing a lock across different threads: The NSLock class uses POSIX threads to implement its locking behavior. When sending an unlock message to an NSLock object, ...
Dracula's user avatar
  • 2,990
3 votes
4 answers
1k views

Swift async let Task throws Cancellation Exception if not Awaited

I am new to Swift Concurrency and trying to understand Task -> ChildTask relationship. I created here two Tasks Parent Task : (1)Calls the test() method in Actor from MainThread. (3.2)The Actor ...
VishnuPrabhu's user avatar

15 30 50 per page
1
2 3 4 5
33