Last Updated: February 25, 2016
·
1.395K
· adelevie

RubyMotion wrapper for MBProgressHud

DRY up your MBProgressHUD in RubyMotion

Usage:

HUD.wrap(@myView, proc do
 sleep 20
end, proc do
 App.alert("Done loading!")
end)

Dependencies:
- MBProgressHUD (duh)
- BubbleWrap::Reactor

Installation:
1. Create a file in lib called hud.rb
2. Add app.files.unshift(*Dir['lib/*.rb']) to your Rakefile

class HUD
 def self.wrap(view, operation, callback)
 MBProgressHUD.showHUDAddedTo(view, animated:true)
 BW::Reactor.defer(operation, proc do
 MBProgressHUD.hideHUDForView(view, animated:true)
 callback.call
 end)
 end
end