Beautiful, simple, customizable and easy to use progress HUD for iOS written in Swift.
Requirements
iOS 10.0+
Xcode 10.2+
Swift 5+
Installation
Swift Package Manager
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. To add a package dependency to your Xcode project, select File > Swift Packages > Add Package Dependency and enter https://github.com/treatwell/TWHud.git.
Carthage
Add the following entry to your Cartfile:
github "treatwell/TWHud"
Usage
First, import TWHud
import TWHud
Then, in your AppDelegate you have to configure TWHud. Required configuration parameters are maskImage - image used as a mask for HUD and colours - array of colours used for animation.
If you need specify which colour should be used after current one, you can add your validator to AppDelegate, after your TWHud configuration.
TWHud.shared?.nextFillColourIndexIsValid = { next, previous in
// Next colour is different than current
var valid: Bool = next != previous
if valid {
if next == 0 {
valid = next != 6
} else if next == 6 {
valid = next != 0
} else if next == 3 {
valid = next != 5
} else if next == 5 {
valid = next != 3
}
}
return valid
}
TWHud
Beautiful, simple, customizable and easy to use progress HUD for iOS written in Swift.
Requirements
Installation
Swift Package Manager
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the
swift
compiler. To add a package dependency to your Xcode project, select File > Swift Packages > Add Package Dependency and enterhttps://github.com/treatwell/TWHud.git
.Carthage
Add the following entry to your Cartfile:
Usage
First, import
TWHud
Then, in your
AppDelegate
you have to configureTWHud
. Required configuration parameters aremaskImage
- image used as a mask for HUD andcolours
- array of colours used for animation.You can configure even more, e.g.:
After configuring your
TWHud
inAppDelegate
, you can use it anywhere in you iOS app codeThis will create HUD over all your UI
Dismiss it using
If you don’t need HUD over all your UI elementes, you can add it to your custom view
Dismiss it using
If you need specify which colour should be used after current one, you can add your validator to
AppDelegate
, after yourTWHud
configuration.Author Information
Marius Kažemėkaitis - marius@treatwell.com
License
The contents of this repository is licensed under the Apache License, version 2.0.