-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Swift Task Naming API #2619
base: main
Are you sure you want to change the base?
Swift Task Naming API #2619
Conversation
7f71aac
to
c0e0748
Compare
|
||
```swift | ||
extension Task { | ||
var currentName: String? { get } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var currentName: String? { get } | |
// read the name of a task instance, e.g. someTask.name | |
var name: String? { get } | |
// read the name of the current task, e.g. Task.name | |
static var currentName: String? { get } |
) | ||
|
||
mutating func addTaskUnlessCancelled( | ||
name: String? = nil, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name: String? = nil, | |
name: String?, |
|
||
```swift | ||
mutating func addTask( | ||
name: String? = nil, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name: String? = nil, | |
name: String?, |
operation: sending @escaping @isolated(any) () async -> Success | ||
|
||
static func detached( | ||
name: String? = nil, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name: String? = nil, | |
name: String?, |
|
||
```swift | ||
init( | ||
name: String? = nil, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name: String? = nil, | |
name: String?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I may ask: is something you both would consider for the naming API to use an enum? I am asking this, because it would be also good to in case of having to iterate over the Tasks we may have, comparing them or even making using a switch
. Of course, my suggestion is not to remove the String as a type for naming it, but having a second flexible way to deal with them.
What do you think?
```swift | ||
init( | ||
name: String? = nil, | ||
priority: TaskPriority? = nil, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
priority: TaskPriority? = nil, | |
executorPreference taskExecutor: (any TaskExecutor)? = nil, | |
priority: TaskPriority? = nil, |
|
||
static func detached( | ||
name: String? = nil, | ||
priority: TaskPriority? = nil, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
priority: TaskPriority? = nil, | |
executorPreference taskExecutor: (any TaskExecutor)? = nil, | |
priority: TaskPriority? = nil, |
@Harjas12 I did some updates, please check and merge them :) |
d1443e9
to
205a51e
Compare
No description provided.