icanzilb / SwiftSpinner

A beautiful activity indicator and modal alert written in Swift (originally developed for my app DoodleDoodle) Using blur effects, translucency, flat and bold design - all iOS 8 latest and greatest
MIT License
2.19k stars 268 forks source link

The addTapHandler is not working if the show contains a delay (because of async Spinner hard to return I guess) #123

Open MarcHe124 opened 6 years ago

andreamazz commented 6 years ago

Hi @MarcHe124 how are you attaching the tap handler to a spinner with a delay? Your best course of action would be to do it as it's done in the demo project:

DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
    SwiftSpinner.show("Connecting \nto satellite...").addTapHandler({
    print("tapped")
    SwiftSpinner.hide()
  }, subtitle: "Tap to hide while connecting! This will affect only the current operation.")
})

Since when a spinner is shown the previous tap handler is cleared.