AwaitKit icon indicating copy to clipboard operation
AwaitKit copied to clipboard

AwaitKit doesn't compile in Xcode 13 / Swift 5.5

Open siejkowski opened this issue 4 years ago • 11 comments

The introduction of async/await in Swift 5.5 (https://github.com/apple/swift-evolution/blob/main/proposals/0296-async-await.md) promoted the "await" word to keyword. Therefore to use it in the context of function call, it must be wrapped in backticks, just as for the methods called with other language keywords.

I've made a PR that adds the backticks in the right place: https://github.com/yannickl/AwaitKit/pull/57

Change is compatible with previous Swift versions.

siejkowski avatar Jun 08 '21 10:06 siejkowski

Oh great! Let me check your PR, thanks.

yannickl avatar Jun 09 '21 09:06 yannickl

new release?

dexterliu1214 avatar Jun 11 '21 01:06 dexterliu1214

A new release would be interesting...

burhan1875 avatar Jun 24 '21 13:06 burhan1875

Yeah a new release would be great @yannickl - using master branch directly for now.

hactar avatar Sep 10 '21 21:09 hactar

Yeah a new release would be great @yannickl - using master branch directly for now.

I just got an error near the 'async', how do you solve this issue? image

zyflovelam avatar Sep 15 '21 02:09 zyflovelam

Yeah, Xcode 13 broke a bunch of things for us as well:

  1. async { try await(...)} -> 'async(priority:operation:)' is only available in iOS 15.0 or newer
  2. return Promise<AVURLAsset?> { seal in ... -> Cannot pass function of type '(Resolver<AVURLAsset?>) async -> Void' to parameter expecting synchronous function type

rpavlovs avatar Sep 21 '21 02:09 rpavlovs

Yeah, Xcode 13 broke a bunch of things for us as well:

  1. async { try await(...)} -> 'async(priority:operation:)' is only available in iOS 15.0 or newer
  2. return Promise<AVURLAsset?> { seal in ... -> Cannot pass function of type '(Resolver<AVURLAsset?>) async -> Void' to parameter expecting synchronous function type

I got an easier way to solve it. I download the source code and copy them to my project. then I renamed all 'async' and 'await' keywords, I added the prefix 'ak', so now I just need to call 'akasync' and 'akawait'.

zyflovelam avatar Sep 21 '21 11:09 zyflovelam

Installing Xcode 12 and 13 in parallel (just rename it before copying into applications folder) allows building with Xcode 12 for iOS 15 with no issues.

rpavlovs avatar Sep 21 '21 16:09 rpavlovs

I can confirm that by installing the lib with #57 merged and wrapping every async/await in the project with back-ticks, it is possible to compile on Xcode 13.

-   pod 'AwaitKit', '~> 5'
+   pod 'AwaitKit', :git => 'https://github.com/yannickl/AwaitKit.git', :branch => 'master'

-   return async {
+   return `async` {

-   try await(...)
+   try `await`(...)

fontesrp avatar Sep 24 '21 16:09 fontesrp

@yannickl Is there a chance for a new version release with @siejkowski support for Swift 5.5 / Xcode 13 soon?

Zaprogramiacz avatar Oct 12 '21 07:10 Zaprogramiacz

Hi,

could you make a new tag soon with Swift 5.5/Xcode 13 fix? It is needed if I want to use component through swift package manager.

Thanks.

p-barabas avatar Aug 12 '22 07:08 p-barabas