GradientLoadingBar alternatives and similar libraries
Based on the "Activity Indicator" category.
Alternatively, view GradientLoadingBar alternatives based on common mentions on social networks and blogs.
-
SVProgressHUD
A clean and lightweight progress HUD for your iOS and tvOS app. -
NVActivityIndicatorView
A collection of awesome loading animations -
SkeletonView
☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting -
M13ProgressSuite
A suite containing many tools to display progress information on iOS. -
PKHUD
A Swift based reimplementation of the Apple HUD (Volume, Ringer, Rotation,…) for iOS 8. -
MRProgress
Collection of iOS drop-in components to visualize progress -
ProgressHUD
ProgressHUD is a lightweight and easy-to-use HUD for iOS. -
DACircularProgress
DACircularProgress is a UIView subclass with circular UIProgressView properties. -
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 -
FillableLoaders
Completely customizable progress based loaders drawn using custom CGPaths written in Swift -
MKRingProgressView
⭕️ Ring progress view similar to Activity app on Apple Watch -
LiquidLoader
Spinner loader components with liquid animation -
YLProgressBar
UIProgressView replacement with an highly and fully customizable animated progress bar in pure Core Graphics -
KDCircularProgress
A circular progress view with gradients written in Swift -
MBCircularProgressBar
A circular, animatable & highly customizable progress bar from the Interface Builder (Objective-C) -
FFCircularProgressView
FFCircularProgressView - An iOS 7-inspired blue circular progress view -
PageControls
This is a selection of custom page controls to replace UIPageControl, inspired by a dribbble found here: https://dribbble.com/shots/2578447-Page-Control-Indicator-Transitions-Collection -
Windless
Windless makes it easy to implement invisible layout loading view. -
StackViewController
A controller that uses a UIStackView and view controller composition to display content in a list -
ParticlesLoadingView
A customizable SpriteKit particles animation on the border of a view. -
AlamofireNetworkActivityIndicator
Controls the visibility of the network activity indicator on iOS using Alamofire. -
Skeleton
✨ An easy way to create sliding CAGradientLayer animations! Works great for creating skeleton screens for loading content. -
WSProgressHUD
This is a beauful hud view for iPhone & iPad -
FlexibleSteppedProgressBar
Flexible Stepped Progress Bar for IOS -
EZLoadingActivity
:hatching_chick: Lightweight Swift loading activity for iOS7+ -
GearRefreshControl
A custom animation for the UIRefreshControl -
iOS Circle Progress Bar
iOS Circle Progress Bar -
GradientProgressBar
📊 A customizable gradient progress bar (UIProgressView). -
RSLoadingView
Awesome loading animations using 3D engine written with Swift -
BigBrother
Automatically sets the network activity indicator for any performed request. -
DSGradientProgressView
A simple animated progress bar in Swift -
StepProgressView
Step-by-step progress view with labels and shapes. A good replacement for UIActivityIndicatorView and UIProgressView. -
Hexacon
A fancy hexagonal layout for displaying data like your Apple Watch -
RPCircularProgress
Circular progress UIView subclass with UIProgressView properties -
AudioIndicatorBars
AIB indicates for your app users which audio is playing. Just like the Podcasts app. -
IHProgressHUD
A clean and lightweight progress HUD based on SVProgressHUD, converted to Swift with the help of Swiftify. -
KYNavigationProgress
Simple extension of UINavigationController to display progress on the UINavigationBar. -
RHPlaceholder
Show pleasant loading view for your users 😍 -
RPLoadingAnimation
Loading animations :cyclone: by using Swift CALayer -
LinearProgressBar
A simple Linear Progress Bar for IOS (Swift 3.0), inspired by Material Design -
StatusBarOverlay
StatusBarOverlay will automatically show a "No Internet Connection" bar when your app loses connection, and hide it again. It supports apps which hide the status bar and The Notch -
ProgressIndicatorView
An iOS progress indicator view library written in SwiftUI
Appwrite - The open-source backend cloud platform
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of GradientLoadingBar or a related project?
README
GradientLoadingBar
A customizable animated gradient loading bar. Inspired by iOS 7 Progress Bar from Codepen.
Example
[Example][example]
To run the example project, clone the repo, and open the workspace from the Example directory.
Requirements
- Swift 5.5
- Xcode 13.2+
- iOS 9.0+
Integration
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate GradientLoadingBar into your Xcode project using CocoaPods, specify it in your Podfile
:
pod 'GradientLoadingBar', '~> 2.0'
Carthage
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate GradientLoadingBar into your Xcode project using Carthage, specify it in your Cartfile
:
github "fxm90/GradientLoadingBar" ~> 2.0
Run carthage update to build the framework and drag the built GradientLoadingBar.framework
, as well as the dependency LightweightObservable.framework
, into your Xcode project.
Swift Package Manager
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler. It is in early development, but Gradient Loading Bar does support its use on supported platforms.
Once you have your Swift package set up, adding Gradient Loading Bar as a dependency is as easy as adding it to the dependencies
value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/fxm90/GradientLoadingBar", from: "2.0.3")
]
How to use
This framework provides four classes:
- GradientLoadingBar: A controller, managing the visibility of the
GradientActivityIndicatorView
on the current key window. - NotchGradientLoadingBar: A subclass of
GradientLoadingBar
, wrapping theGradientActivityIndicatorView
around the notch of the iPhone. - GradientActivityIndicatorView: A
UIView
containing the gradient with the animation. It can be added as a subview to another view either inside the interface builder or programmatically. Both ways are shown inside the example application. - GradientLoadingBarView: A
View
for SwiftUI containing the gradient with the animation. The view can be added to any other SwiftUI view. The example application also contains sample code for this use case.
GradientLoadingBar
To get started, import the module GradientLoadingBar
into your file and save an instance of GradientLoadingBar()
on a property of your view-controller. To show the loading bar, simply call the fadeIn(duration:completion)
method and after your async operations have finished call the fadeOut(duration:completion)
method.
final class UserViewController: UIViewController {
private let gradientLoadingBar = GradientLoadingBar()
// ...
override func viewDidLoad() {
super.viewDidLoad()
gradientLoadingBar.fadeIn()
userService.loadUserData { [weak self] _ in
// ...
// Be sure to call this on the main thread!
self?.gradientLoadingBar.fadeOut()
}
}
}
Configuration
You can override the default configuration by calling the initializers with the optional parameters height
and isRelativeToSafeArea
:
let gradientLoadingBar = GradientLoadingBar(
height: 4.0,
isRelativeToSafeArea: true
)
– Parameter height: CGFloat
By setting this parameter you can set the height for the loading bar (defaults to 3.0
)
– Parameter isRelativeToSafeArea: Bool
With this parameter you can configure, whether the loading bar should be positioned relative to the safe area (defaults to true
).
Example with isRelativeToSafeArea
set to true
.
[[Example][basic-example--thumbnail]][basic-example]
Example with isRelativeToSafeArea
set to false
.
[[Example][safe-area-example--thumbnail]][safe-area-example]
Note
There is a third option which will wrap the loading bar around the iPhone notch. See documentation of the class NotchGradientLoadingBar
for further details.
Properties
– gradientColors: [UIColor]
This property adjusts the gradient colors shown on the loading bar.
– progressAnimationDuration: TimeInterval
This property adjusts the duration of the animation moving the gradient from left to right.
Methods
– fadeIn(duration:completion)
This method fades-in the loading bar. You can adjust the duration with corresponding parameter. Furthermore you can pass in a completion handler that gets called once the animation is finished.
– fadeOut(duration:completion)
This methods fades-out the loading bar. You can adjust the duration with corresponding parameter. Furthermore you can pass in a completion handler that gets called once the animation is finished.
Custom shared instance (Singleton)
If you need the loading bar on multiple / different parts of your app, you can use the given static shared
variable:
GradientLoadingBar.shared.fadeIn()
// Do e.g. server calls etc.
GradientLoadingBar.shared.fadeOut()
If you wish to customize the shared instance, you can add the following code e.g. to your app delegate didFinishLaunchingWithOptions
method and overwrite the shared
variable:
GradientLoadingBar.shared = GradientLoadingBar(height: 5.0)
NotchGradientLoadingBar
This subclass of the GradientLoadingBar
will wrap the loading bar around the notch of the iPhone.
For iPhones without a safe area, the behaviour stays the same as mentioned in the above documentation of the GradientLoadingBar
.
let notchGradientLoadingBar = NotchGradientLoadingBar(
height: 3.0
)
[[Example][notch-example--thumbnail]][notch-example]
GradientActivityIndicatorView
In case you don't want to add the loading bar onto the key-window, this framework provides the GradientActivityIndicatorView
, which is a direct subclass of UIView
. You can add the view to another view either inside the interface builder or programmatically.
E.g. View added as a subview to a UINavigationBar
.
[[Example][navigation-bar-example--thumbnail]][navigation-bar-example]
E.g. View added as a subview to a UIButton
.
[[Example][advanced-example--thumbnail]][advanced-example]
Note
The progress-animation starts and stops according to the isHidden
flag. Setting this flag to false
will start the animation, setting this to true
will stop the animation. Often you don't want to directly show / hide the view and instead smoothly fade it in or out. Therefore the view provides the methods fadeIn(duration:completion)
and fadeOut(duration:completion)
. Based on the gist UIView+AnimateAlpha.swift
, these methods adjust the alpha
value of the view and update the isHidden
flag accordingly.
Properties
– gradientColors: [UIColor]
This property adjusts the gradient colors shown on the loading bar.
– progressAnimationDuration: TimeInterval
This property adjusts the duration of the animation moving the gradient from left to right.
To see all these screenshots in a real app, please have a look at the **example application. For further customization you can also subclass GradientLoadingBar
and overwrite the method setupConstraints()
.
GradientLoadingBarView
This is the SwiftUI variant for the GradientActivityIndicatorView
. The view can be configured via the two parameters gradientColors: [Color]
and progressDuration: TimeInterval
passed to the initializer.
– gradientColors: [Color]
:
This parameter adjusts the gradient colors shown on the loading bar.
– progressDuration: TimeInterval
:
This parameter adjusts the duration of the animation moving the gradient from left to right.
The visibility of the view can be updated with the view modifier opacity()
or hidden()
.
To animate the visibility changes you need to create a property with the @State
property wrapper, and update the value from a withAnimation
block, e.g.
struct ExampleView: some View {
@State
private var isVisible = false
var body: some View {
VStack {
GradientLoadingBarView()
.frame(maxWidth: .infinity, maxHeight: 3)
.cornerRadius(1.5)
.opacity(isVisible ? 1 : 0)
Button("Toggle visibility") {
withAnimation(.easeInOut) {
isVisible.toggle()
}
}
}
}
}
Troubleshooting
Interface Builder Support
Unfortunately the Interface Builder support is currently broken for Cocoapods frameworks. If you need Interface Builder support, add the following code to your Podfile and run pod install
again. Afterwards you should be able to use the GradientLoadingBar
inside the Interface Builder :)
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
next unless config.name == 'Debug'
config.build_settings['LD_RUNPATH_SEARCH_PATHS'] = [
'$(FRAMEWORK_SEARCH_PATHS)'
]
end
end
Source: Cocoapods – Issue 7606
Author
Felix Mau (me(@)felix.hamburg)
License
GradientLoadingBar is available under the MIT license. See the LICENSE file for more info.
*Note that all licence references and agreements mentioned in the GradientLoadingBar README section above
are relevant to that project's source code only.