As an Apple fan, Google's design guidelines called Material Design really impressed me a lot, and I found myself falling in love with it!
Although there is an awesome framework implemented lots of Material components (Material by @CosmicMind), I'm here to make my own.
Well, the animation is a little bit crappy, but it's not that bad right? :p
Finally I've got a better animation.
Here's how it looks like:
func after(_ seconds: Double, action: @escaping () -> Void) {
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(Int64(NSEC_PER_SEC) * Int64(seconds)) / Double(NSEC_PER_SEC), execute: action)
}
use as HUD
let loader = MaterialLoader.showInView(view)
after(5, action: { () -> Void in
loader.dismiss()
})
or pull to refresh
MaterialLoader.addRefreshHeader(scrollView) { () -> Void in
after(5, action: { () -> Void in
self.scrollView.endRefreshing()
})
}
- iOS 8.0+
- Xcode 7.2+
Put github "CaptainTeemo/MaterialLoader"
in your cartfile and run carthage update
from terminal, then drag built framework to you project.
Hope you like it.