Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflicting SDK name with Apple's Framework name: Task modifier #1201

Open
ashleydee1999 opened this issue Feb 27, 2023 · 2 comments
Open

Conflicting SDK name with Apple's Framework name: Task modifier #1201

ashleydee1999 opened this issue Feb 27, 2023 · 2 comments

Comments

@ashleydee1999
Copy link

Hi,

I'm trying to run an asynchronous task in SwiftUI, however, I'm failing to do so because the SDK is using the same name as Apple's framework. You structure your code as follows in swift to run an asynchronous task:

  Task{
              await myAsycFunc()
          }

The conflict arises from this file Graph.Task.swift . It has the following protocol definition:

public protocol Task {
    
    /// Starts the underlying task
    func resume()
    
    /// Cancel the underlying task
    func cancel()
}

My error then becomes: 'any Task' cannot be constructed because it has no accessible initializers

@maxxfrazer
Copy link

maxxfrazer commented Mar 3, 2023

@cocoahero this is a pretty tricky issue, causing build errors for anyone using async commands in Swift with the Task<Success, Failure> struct from the Concurrency framework.

I know it's annoying, but if this could be renamed to something like BuyDataTask or something else that would be more appropriate in the next version that would be great. IMO "Task", and also "Graph" are a bit too generic to be public classes.

@markshiz
Copy link

markshiz commented May 5, 2024

FWIW - My work around for this is to do the following in my app. But I agree that another name should be chosen here.

import Buy

typealias Task = _Concurrency.Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants