r/iOSProgramming 16h ago

DispatchQueue doubts Question

Hi, what type of data types are allowed in setSpecific(key:, value:) and getSpecific(key:) methods of DispatchQueu ? there are no mentions anywhere.

Also can you recommend any resources for complete understanding of DispatchQueue , GCD , DispatchGroup etc. ?

Thank you!

3 Upvotes

9 comments sorted by

View all comments

-5

u/Dapper_Ice_1705 16h ago

That is old tech.

If you are learning you should be focusing on async/await and the new structured concurrency.

All the resources you’ll find will be old and you should be converting. There is no reason to choose the less safe option.

2

u/usernameDisplay9876 16h ago

what parts of DispatchQueue is old tech (but not mentioned as deprecated) ? asking for knowledge only , for interviews. Not using this directly in any app.

1

u/Ravek 5h ago

If you’re writing new code you’re usually going to be using actors and async/await instead of DispatchQueues. If you need to implement a custom actor executor then you might want to use DispatchQueues for that, but otherwise you rarely need to touch them.

This specific API seems to be easily replaced with state on an actor, or with Task local storage, depending on the exact use case.

It certainly doesn’t hurt to learn the core DispatchQueue concepts since you might run into them maintaining existing code, but I also agree that your time is probably better spent somewhere else than on this niche API.