holyturt / SwiftOverpassWrapper

A wrapper of the Overpass API for Swift.
MIT License
16 stars 2 forks source link

Property on `OverpassAPI` that indicates whether there are ongoing requests #23

Closed wtimme closed 6 years ago

wtimme commented 6 years ago

As a user, I want an app which downloads data from Overpass to indicate that data is currently being downloaded, so that the app feels more responsive to me.

In my own app, I've implemented a simple counter that is increased before a request is started, and decreased when the request finished (in the completion closure). It would be great if such functionality was offered by OverpassAPI, e. g. in the form of a publicly accessible

var areRequestsInProgress: Bool {
    return 0 < numberOfRequestsInProgress
}

What do you think, @holyturt? I have no idea whether my approach is the way to go. The last thing that I want is an infinite loading spinner. Is the completion closure of the network request always executed? Your input is highly appreciated!

wtimme commented 6 years ago

Just a quick update: The counter seems to work reliably. 👍🏼

wtimme commented 6 years ago

I was able to achieve the same using the Alamofire/AlamofireNetworkActivityIndicator, and the network layer is of course more appropriate to keep track of the requests. 😅