[Migration][API] Artist/search

Hello everyone,

I find myself facing a challenge in my current project with the application, where I have to migrate the artist search code to use Swift Concurrency. I hope someone here can guide me or share similar experiences.

Context
We have an endpoint called Artist/Search that we use to retrieve information about artists. Currently, this process does not use Swift Concurrency, and I am looking to modernize this part of the code to improve both performance and readability.

What I’m trying to do
I want to migrate our current logic to an approach based on Swift Concurrency. For those who are unfamiliar, this means I want to use Swift’s modern features to manage asynchronous operations more efficiently and securely.

Why I need help
Although I have a basic understanding of Swift Concurrency, applying these concepts to our specific artist search module has proved to be more complex than expected. I find it difficult to structure requests and responses in a way that takes full advantage of the benefits of competition.

Concrete example
Here is what I would like to accomplish:

Given: A user performs an artist search in the application.
When: This research is treated using the principles of Swift Concurrency.
Then: The results are returned and displayed without UI blocking or unexpected delays.
I am particularly interested in code examples or strategies for structuring network calls and data processing using Swift Concurrency.

Thank you all in advance for your time and help. Any suggestion, advice, or sample code would be greatly appreciated and would be very helpful to me in moving forward with this project.

struct Search {
            static let index = "search/index"
            static let reportEvent = "search/report"
            static let global = "catalog/search"
            static let album = "album/search"
            static let artist = "artist/search"
            static let mostpopular = "most-popular/get"
            static let story = "story/search"
            static let track = "track/search"
            static let playlist = "playlist/search"
        }

Artist

import Dependencies
import Foundation

extension Endpoint {

    struct Artist {

        static func getArtist(with identifier: Int) -> Endpoint {
            @Dependency(\.apiConfiguration) var apiConfig
            let scheme = apiConfig.scheme
            let host = apiConfig.host
            let path = apiConfig.path
            let service = "/artist/get"
            let queryItems = [URLQueryItem(name: "artist_id", value: String(identifier))]
            return Endpoint(scheme: scheme, host: host, path: path + service, queryItems: queryItems)
        }

    }
}