algolia / algoliasearch-client-swift

⚑️ A fully-featured and blazing-fast Swift API client to interact with Algolia.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Naming clash with Swift's Task

mschinis opened this issue Β· comments

Describe the bug πŸ›
Hi, I'm in the process of adopting async/await in our project. Wherever I have an import AlgoliaSearchClient, I cannot use Swift's Task type because it clashes with the library's Task protocol:

Compile time error

'Task' cannot be constructed because it has no accessible initializers

Current workaround

To work-around this for now, I can use _Concurrency.Task but would generally like to avoid having to to do so, as it uses the semiprivate _Concurrency module.

To Reproduce πŸ”
Steps to reproduce the behavior:

  1. import AlgoliaSearchClient in a project file
  2. Use this code somewhere in that file:
Task {
    try await Task.sleep(1_000_000_000) // 1 second
}

Expected behavior πŸ’­
Be able to import AlgoliaSearchClient and use the swift Task type without using _Concurrency

Hi @mschinis ,
Thank you for reporting this issue. It's actually embarrassing.
I will look into it πŸ”

no worries - your protocol has probably been around before Swift's Task anyway 😬

Fixed in the release 8.14 βœ…

Thank you @VladislavFitz πŸ™Œ