IOS Apollo, Swift 5.5 async await

Hey!

I see that swift is now coming with async and await, and i was wondering if the Apollo Library going to support this in the future? And if, when?

Best regards
Alexander Larsen

Great question! The short answer is we definitely plan to support it, but when is pretty unclear at this point.

One major factor is whether Apple actually winds up creating a way to support this on older versions of the various operating systems. It at least looks like they’re trying, but it’s not clear when and how it’s going to land. With current betas, it only supports iOS 15+ and the other operating systems which are still in beta, and Apollo currently supports 12+. Even if Apple’s current attempt does land, it does appear it’d be 13+, so we’d need to make some decisions around that as well.

If you’re super-eager to get started, wrapping the closure-based APIs with continuations is probably the place to start. We could look at putting some kind of wrapper library together that does this for you once we’ve managed to nail down some more stuff on our 1.0 roadmap, but again, I can’t commit to a timeline on that. We do always love community contributions though, and if you’re interested in trying to make this work, we’d be happy to work with you!

There’s potentially large advantages for us in adapting async/await internally, though, so we are certainly incentivized to consider doing this sooner rather than later if Apple can make the backport work.

1 Like

Any updates on this?

Backported concurrency is available for iOS 13+ starting from Xcode 13.2 - release notes.

New Features

  • You can now use Swift Concurrency in applications that deploy to macOS Catalina 10.15, iOS 13, tvOS 13, and watchOS 6 or newer. This support includes async / await , actors, global actors, structured concurrency, and the task APIs. (70738378)

Known Issues

  • Apps built with Xcode 13 or Xcode 13.1 that make use of Swift Concurrency features (such as async / await ), deploy to iOS prior to 15, tvOS prior to 15, or watchOS prior to 8, and have bitcode enabled may crash at launch with an error reporting that the libswift_Concurrency.dylib library was not loaded. (86349088)

Workaround : Add -Wl,-weak-lswift_Concurrency -Wl,-rpath,/usr/lib/swift to Other Linker Flags in the app’s build settings.

Hi @mpokhylets, this won’t be supported until version 2.0.

Currently we still support iOS 12 and our focus is wrapping up features for 1.0, which is nearing the end of the alpha release cycle. Once 1.0 is done we can shift our focus to 2.0 which is a modernization of the networking stack, moving to iOS 13, and bringing the community modern Swift features like async/await.