Reader small image

You're reading from  An iOS Developer's Guide to SwiftUI

Product typeBook
Published inMay 2024
Reading LevelBeginner
PublisherPackt
ISBN-139781801813624
Edition1st Edition
Languages
Right arrow
Author (1)
Michele Fadda
Michele Fadda
author image
Michele Fadda

Michele is currently working as a technical project and program manager at Eggon, an innovative startup in Padua, Italy, and as the director of FWLAB Limited, a UK App development studio. He specializes in skills such as Imperative Programming, Functional programming, Swift, Mobile Application Development. He started programming as a child with Assembly language and has worked for 20 years as a consultant using a variety of languages and technologies. He started developing for iOS with iOS on iOS v.3.0 in 2009. He has also developed many apps as a solo developer and has also participated in numerous projects.
Read more about Michele Fadda

Right arrow

Understanding tasks

Tasks are “units of work” that can run concurrently, and they are a higher-level abstraction over threads, queues, and similar concurrency primitives. Essentially, in Swift, a task is simply a piece of work that can run in parallel with other tasks. In contrast to threads and queues, tasks are managed by the Swift runtime and not by the operating system. This makes them more lightweight and efficient. Moreover, this allows structured concurrency to be backported by Apple to iOS 13 just by updating Xcode, as iOS 13 did not offer this feature when it was first introduced.

Beware that in the first iterations of structured concurrency, you were supposed to be able to declare a task just by using the async keyword, followed by do/catch. The async keyword followed by do/catch syntax method has been replaced with task initialization. You won’t find that in this book; if you happen to find it in old code, just replace async with an appropriate task...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
An iOS Developer's Guide to SwiftUI
Published in: May 2024Publisher: PacktISBN-13: 9781801813624

Author (1)

author image
Michele Fadda

Michele is currently working as a technical project and program manager at Eggon, an innovative startup in Padua, Italy, and as the director of FWLAB Limited, a UK App development studio. He specializes in skills such as Imperative Programming, Functional programming, Swift, Mobile Application Development. He started programming as a child with Assembly language and has worked for 20 years as a consultant using a variety of languages and technologies. He started developing for iOS with iOS on iOS v.3.0 in 2009. He has also developed many apps as a solo developer and has also participated in numerous projects.
Read more about Michele Fadda