:hatching_chick: Lightweight Swift loading activity for iOS7+

Overview

EZLoadingActivity

CocoaPods Compatible Carthage compatible

Lightweight Swift loading activity for iOS7+. Really simple to use, just add the class and write 1 line of code.

demo

Easy to use:

EZLoadingActivity.show("Loading...", disableUI: true)

'disableUI' stops user interactions until you hide loadingactivity.

How to dismiss:

EZLoadingActivity.hide(success: true, animated: true)

Failure:

EZLoadingActivity.hide(success: false, animated: true)

demo

Without Animation:

EZLoadingActivity.hide(success: true, animated: false)

demo

Hide Directly:

EZLoadingActivity.hide()

demo

Editing:

EZLoadingActivity.Settings.SuccessColor = UIColor.blueColor()
EZLoadingActivity.show("Loading...", disableUI: false)
Settings Options
BackgroundColor
ActivityColor
TextColor
FontName
SuccessIcon
FailIcon
SuccessText
FailText
SuccessColor
FailColor
ActivityWidth
ActivityHeight

Example Use Case:

EZLoadingActivity.show("Uploading...", disableUI: false)

var postObject = PFObject(className: "className")
postObject.saveInBackgroundWithBlock { (succeeded: Bool, error: NSError!) -> Void in
    if error == nil {
       if succeeded == true {
          EZLoadingActivity.hide(success: true, animated: false)
          print("Upload Complete")
        } else {
          EZLoadingActivity.hide(success: false, animated: true)
          print("Upload Failed")
       }
    } else {
        EZLoadingActivity.hide(success: false, animated: true)
        print("Error")
    }
}

######Showing EZLoadingActivity for a certain time:

EZLoadingActivity.showWithDelay("Waiting...", disableUI: false, seconds: 2)

######Showing EZLoadingActivity from App Window(For example: for Split view controller):

EZLoadingActivity.Settings.LoadOverApplicationWindow = true

No object tracking:

EZLoadingActivity is a singleton object so you don't need to keep track of its instance.

##Installation (~10 seconds)

  1. Download and drop 'EZLoadingActivity.swift' in your project.
  2. Congratulations!

Install via Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate EZLoadingActivity into your Xcode project using Carthage, specify it in your Cartfile:

github "goktugyil/EZLoadingActivity"

Run carthage update to build the framework and drag the built EZLoadingActivity.framework into your Xcode project.

Then on the top of files where you are going to use this:

import EZLoadingActivity

Install via CocoaPods

You can use CocoaPods to install EZLoadingActivity by adding it to your Podfile:

platform :ios, '8.0'
use_frameworks!

pod 'EZLoadingActivity' #Stable release for Swift 3.0

pod 'EZLoadingActivity', :git => 'https://github.com/goktugyil/EZLoadingActivity.git' #Latest release for Swift 3.0
pod 'EZLoadingActivity', '~> 0.8' #For Swift 2.2

Then on the top of files where you are going to use this:

import EZLoadingActivity

##Requirements

  • Xcode 6 or later (Tested on 7)
  • iOS 7 or later (Tested on 9)

##Possible features

##License EZLoadingActivity is available under the MIT license. See the LICENSE file.

##Keywords swift, hud, loading, activity, progresshud, progress, track, spinner,

Comments
  • Orientation issue

    Orientation issue

    Thanks for the lovely simple-to-use control.

    I noticed however that it doesn't support landscape orientation. It keeps showing the animation based on the initial portrait orientation.

    opened by polis80cy 11
  • The view isn't in the centre when in a VC that is presented modally or is the master/detail

    The view isn't in the centre when in a VC that is presented modally or is the master/detail

    I tried to present an EZLoadingActivity in a Form Sheet view controller and it is off centred. It appears at about the bottom left corner of the form sheet. It isn't centred either when it is in a master-detail view controller.

    To reproduce, create a view controller A in the storyboard. Add a button that triggers a segue like this:

    screen shot 2016-06-30 at 5 06 53 pm screen shot 2016-06-30 at 5 07 14 pm

    Connect the segue to view controller B.

    In view controller B viewDidLoad, show the EZLoadingActivity.

    I think this is due to showing the view in the window. Can you do something about it so that it always appears centered in the current view controller?

    opened by Sweeper777 8
  • Loading indicator doesnt hide

    Loading indicator doesnt hide

    Hi, The indicator doesnt hide when i call the hide method. But this hide after a few second after i passed on the hide method ( +/-10 seconds)

    After this, when i continue to press my button for show the indicator, this doesnt show.

    opened by Persilos 6
  • Warning:

    Warning: "Result of call to 'hide(_:animated:)' is unused"

    Hi, Your loading indicator works well. However, Xcode alaway gives warnings of "Result of call to hide(_:animated:)' is unused and also in the case of show(). How could I deal with this?

    opened by yuchenglin 5
  • Separate instantiation from showing the view. Otherwise it can happen…

    Separate instantiation from showing the view. Otherwise it can happen…

    … that you end up in a situation where the UI is blocked.

    In the original version where instantiation and showing is done in one step (dispatch main) it can be that the dispatch didn't occur when you call the hide method. Hide is checking as a first step if there is an instance, which is not, because the main thread didn't elaborate it yet, and exits. Then at a point in time the main thread is showing the Indicator with blocking id, and never gets dismissed.

    With this change the instance is there, even if it hasn't been shown and as both showing and hiding happen in the same thread (main) it will be shown and immediately hidden, and the UI is unblocked.

    opened by hons82 4
  • View is pretty large on Ipad

    View is pretty large on Ipad

    Hey

    I love your implementation of this and how simple it is to use! Tried it for Ipad but it covered almost the entire screen which is a bit brute :D So I added this setting which let's you manually set the width divider (standard was 1.6)

    Probably not the prettiest way to add to it but it works and it's a very fast enhancement :)

    In Settings struct static var CLAWidthDivision = 1.6 In loadingActivity: let width = sender.view.frame.width / CGFloat(Settings.CLAWidthDivision) Before calling showMethod: CozyLoadingActivity.Settings.CLAWidthDivision = 4.6 (about right for Ipad)

    Thanks again!

    PS don't use github that much so thought I'd add it here and you can mark it as enhancement or something :) Cheers

    opened by NickBols 4
  • Convert to Swift 3 syntax

    Convert to Swift 3 syntax

    This pull request converts the framework to Swift 3 syntax. It would be best to move the old version to a Swift-2 branch before merging this pull request.

    opened by rugheid 3
  • Swift 3 issue

    Swift 3 issue

    I see commits 3 days ago that indicate Swift 3 support. But, I get 40 compiler errors when I include your pod: basic pre-Swift 3 stuff like "NSTimeInterval has been renamed to "TimeInterval". I've cleaned the pod cache, reinstalled. Can you help me?

    opened by Jiropole 2
  • EZLoadingActivity: You don't have an activity Instance?

    EZLoadingActivity: You don't have an activity Instance?

    I'm getting an EZLoadingActivity: You don't have an activity Instance problem when trying to call up EZLoadingActivity.hide(success: false, animated: true)

    opened by jgebbeken 2
  • LoadingActivity doesn't hide if scrolling started

    LoadingActivity doesn't hide if scrolling started

    Lets get to it quickly, lets say we have UITableView and I've showed the LoadingActivity Success and i immediately started scrolling to the bottom, so the LoadingActivity will stay showing until i stop my scroll then it will disappear. why is that ? it should disappear in anyway whenever i scroll or not in a specific time ! Thanks,

    bug 
    opened by AaoIi 2
  • What is the correct way to change the text while the loading activity is presented?

    What is the correct way to change the text while the loading activity is presented?

    I want to show the user the progress of the time-consuming task that I'm performing. Let's say I want to first show "Performing Task 1 of 10". After the first task is completed, I want to change the text to say "Performing Task 2 of 10" and so on. And after performing all tasks, I want to hide it.

    Do I just simply call show with different text multiple times?

    opened by Sweeper777 1
  • Feature Request: Optionally show the loading activity as a subview of the window?

    Feature Request: Optionally show the loading activity as a subview of the window?

    Currently, the LoadingActivity view seems to be added as a subview of the topViewController. This means that I cannot show the loading activity, and keep it showing while I perform a segue that goes to another VC.

    I think adding the loading activity as a subview of the window should fix this, but this would not work if the view controller is not full screen (see #23). Therefore, I think it would be best to provide an option to add the loading activity to the window.

    Either:

    • Accept a UIViewController? parameter in show. When this is nil, show the loading activity in the window, otherwise show it as a subview of the view of the VC, or
    • Accept a Bool parameter called showAsSubviewOfWindow. This won't break existing code.

    Do you think this is a good idea?

    opened by Sweeper777 1
  • add completion handler to showWithDelay()

    add completion handler to showWithDelay()

    Suggest an additional param for EZLoadingActivity.showWithDelay().

    completion callback/handler makes this method far more useful:

    @discardableResult
    public static func showWithDelay(_ text: String, disableUI: Bool, seconds: Double, completion: (() -> Void)? = nil) -> Bool {
        let showValue = show(text, disableUI: disableUI)
        delay(seconds) { () -> () in
            _ = hide(true, animated: false)
           completion?()
        }
        return showValue
    }
    
    opened by fetzig 0
  • Multiline text in loader

    Multiline text in loader

    I want to add a big text in loader

    We are downloading your records now. Please wait as this can take some time...

    But it appears so small when I use a big text and extra text got truncated.

    Is there any way to use multiline text in this library?

    Thanks in advance.

    opened by anik123 0
  • Text is not visible with indicator

    Text is not visible with indicator

    EZLoadingActivity.show("Updating Expense", disableUI: true)

    i am using EZLoadingActivity to show indicator with text. But on some screen text is not visible with indicator. How can i resolve this issue ?

    bug 
    opened by zeshanarif 3
Owner
Goktug Yilmaz
World-class code copy paster.
Goktug Yilmaz
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

SwiftSpinner SwiftSpinner is an extra beautiful activity indicator with plain and bold style. It uses dynamic blur and translucency to overlay the cur

Marin Todorov 2.1k Dec 19, 2022
The easiest way to handle a simple full screen activity indicator in iOS. Written in Swift.

LLSpinner An easy way to handle full screen activity indicator. Easy to use Get Started // Show spinner LLSpinner.spin() // Hide spinner LLSpinner.st

Aleph Retamal 36 Dec 9, 2021
A metaball loading written in Swift.

DBMetaballLoading Synopsis A metaball loading written in Swift. Special thanks to dodola's MetaballLoading, which is an android project. The animation

ChildhoodAndy 72 Jul 2, 2022
Awesome loading animations using 3D engine written with Swift

RSLoadingView Introduction RSLoadingView bring your app to the new age of loading animations using 3D engine. Written with Swift Customizable Using Ap

null 419 Dec 16, 2022
A number of preset loading indicators created with SwiftUI

A number of preset loading indicators created with SwiftUI

Exyte 968 Jan 8, 2023
NVActivityIndicatorView is a collection of awesome loading animations.

NVActivityIndicatorView is a collection of awesome loading animations.

Vinh Nguyen 10.3k Jan 5, 2023
⌛️A customizable animated gradient loading bar.

GradientLoadingBar A customizable animated gradient loading bar. Inspired by iOS 7 Progress Bar from Codepen. Example To run the example project, clon

Felix M. 791 Dec 26, 2022
Windless makes it easy to implement invisible layout loading view.

Windless Windless makes it easy to implement invisible layout loading view. Contents Requirements Installation Usage Looks Credits Communication Licen

ArLupin 940 Dec 22, 2022
💀 An easy way to create sliding CAGradientLayer animations! Works great for creating skeleton screens for loading content.

Skeleton is an easy way to create sliding CAGradientLayer animations! It works great for creating skeleton screens: ??‍?? Usage The entire library com

Gonzalo Nuñez 668 Nov 2, 2022
Show pleasant loading view for your users 😍

RHPlaceholder ?? Because traditional loading view like UIActivityIndicatorView or similar one are no longer so trendy (Facebook or Instagram apps are

Robert Herdzik 238 Nov 2, 2022
A clean and lightweight progress HUD based on SVProgressHUD, converted to Swift with the help of Swiftify.

IHProgressHUD IHProgressHUD is a clean and easy-to-use HUD meant to display the progress of an ongoing task on iOS and tvOS. IHProgressHUD is based on

Swiftify 202 Dec 22, 2022
Completely customizable progress based loaders drawn using custom CGPaths written in Swift

FillableLoaders Completely customizable progress based loaders drawn using custom CGPaths written in Swift Waves Plain Spike Rounded Demo: Changelog:

Pol Quintana 2.1k Dec 31, 2022
A simple animated progress bar in Swift

DSGradientProgressView Introduction DSGradientProgressView is a simple and customizable animated progress bar written in Swift. Inspired by GradientPr

Dhol Studio 445 Oct 13, 2022
Simple Swift Progress HUD

MKProgress An iOS Simple Swift Progress HUD Requirements iOS 9.0+ Swift 3.0+ Xcode 8.0+ Installation MKProgress is only available via CocoaPods: pod '

Muhammad Kamran 143 Dec 23, 2022
IOS HUD Swift Library

JHProgressHUD JHProgressHUD is an iOS class written in Swift to display a translucent HUD with an indicator and/or labels while work is being done in

Harikrishnan T 79 Feb 27, 2021
Lightweight Swift loading activity for iOS7+

EZLoadingActivity Lightweight Swift loading activity for iOS7+. Really simple to use, just add the class and write 1 line of code. Easy to use: EZLoad

Goktug Yilmaz 611 Dec 22, 2022
A lightweight and awesome loading Activity Indicator for your iOS app.

BPCircleActivityIndicator BPCircleActivityIndicator is a clean and easy-to-use Activity Indicator meant to display the progress of an ongoing task on

Ben.Park 46 Aug 12, 2022
A simple and awesome loading Activity Indicator(with block moving animation) for your iOS app.

BPBlockActivityIndicator BPBlockActivityIndicator is a clean and easy-to-use Activity Indicator meant to display the progress of an ongoing task on iO

Ben.Park 43 Nov 6, 2021
SwiftUI view that download and display image from URL and displaying Activity Indicator while loading .

ViewWithActivityIndicator ViewWithActivityIndicator is a SwiftUI view that download and display image from URL and displaying Activity Indicator while

Ali Adam 28 Feb 3, 2022
Syntactic sugar in Swift for asynchronous dispatches in Grand Central Dispatch (iOS7+ and OS X 10.9+ compatible)

Async.legacy Syntactic sugar in Swift for asynchronous dispatches in Grand Central Dispatch (GCD) Async rewritten for iOS7 and OS X 10.9 Compatibility

Joseph Lord 31 Jul 1, 2019