AssistoLab / KVNProgress

KVNProgress is a fully customizable progress HUD that can be full screen or not.
MIT License
1.24k stars 202 forks source link

Swift Question #53

Open JustinDMoore opened 9 years ago

JustinDMoore commented 9 years ago

I am converting my existing project to Swift and just came across a small hiccup

Previously, I assigned a tap block as such:
KVNProgressConfiguration config = [Configuration errorProgressConfig];
config.tapBlock = ^(KVNProgress
progressView) { KVNProgress.configuration.tapBlock = nil; dispatch_async(dispatch_get_main_queue(), ^{ [KVNProgress dismiss]; }); [self goBack]; };

Everything else with KVNProgress has worked effortlessly with Swift, but how can I translate this to Swift and assign the tap block? Not quite sure how to use a Closure to do this.

JustinDMoore commented 9 years ago

?

config.tapBlock = { progressView in dispatch_async(dispatch_get_main_queue()) { [unowned self] in KVNProgress.dismiss() } self.goBack() }

kevin-hirsch commented 9 years ago

Hello @JustinDMoore, this seems correct. The swift code is only missing your

KVNProgress.configuration.tapBlock = nil;

Which would simply be

KVNProgress.configuration.tapBlock = nil