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:

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") } }">
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
☠️SkeletonUI aims to bring an elegant, declarative syntax to skeleton loading animations.

SkeletonUI aims to bring an elegant, declarative syntax to skeleton loading animations. Get rid of loading screens or spinners and start using skeletons to represent final content shapes.

Carlos Solana Martínez 551 Dec 18, 2022
An easy way to add a shimmering effect to any view with just one line of code. It is useful as an unobtrusive loading indicator.

LoadingShimmer An easy way to add a shimmering effect to any view with just single line of code. It is useful as an unobtrusive loading indicator. Thi

Jogendra 1.4k Jan 6, 2023
BWMCoverView is a very easy to use advertising the carousel view, supports circular scrolling functions such as switching, asynchronous loading of images, animation, custom is very high.

BWMCoverView BWMCoverView is a very easy to use advertising the carousel view, supports circular scrolling functions such as switching, asynchronous l

Bi Weiming 31 Mar 10, 2021
Lightweight animation library for UIKit

MotionAnimation Lightweight animation library for UIKit in Swift Checkout the Examples folder for more. Consider MotionAnimation as a extremely simpli

Luke Zhao 145 May 28, 2022
☄️Comets: Animating Particles in Swift

Comets ☄️ Comets: Animating Particles in Swift animation made by kevin as part of Voicy design implements Bennet van der Linden medium Comets: Animati

Cruz 593 Dec 28, 2022
A DSL to make animation easy on iOS with Swift.

This project is highly inspired by JHChainableAnimations, If you project is developed with Objective-C, use JHChainableAnimations instead. With DKChai

Draven 1.9k Dec 9, 2022
A Swift library to take the power of UIView.animateWithDuration(_:, animations:...) to a whole new level - layers, springs, chain-able animations and mixing view and layer animations together!

ver 2.0 NB! Breaking changes in 2.0 - due to a lot of requests EasyAnimation does NOT automatically install itself when imported. You need to enable i

Marin Todorov 3k Dec 27, 2022
Elegant SVG animation kit for swift

Elephant This is SVG animation presentation kit for iOS. Example You can run example app. Please open Example-iOS/Elephant-iOS.xcworkspace! Usage You

Kazumasa Shimomura 127 Dec 14, 2022
Gemini is rich scroll based animation framework for iOS, written in Swift.

Overview What is the Gemini? Gemini is rich scroll based animation framework for iOS, written in Swift. You can easily use GeminiCollectionView, which

Shohei Yokoyama 3k Dec 27, 2022
Swift interpolation for gesture-driven animations

Interpolate Interpolate is a powerful Swift interpolation framework for creating interactive gesture-driven animations. Usage The ?? idea of Interpola

Roy Marmelstein 1.8k Dec 20, 2022
Pulse animation for iOS written with Swift.

Pulsator Pulse animation for iOS written with Swift. Great For: Pulses of Bluetooth, BLE, beacons (iBeacon), etc. Map Annotations Installation CocoaPo

Shuichi Tsutsumi 1.3k Jan 6, 2023
A library to simplify iOS animations in Swift.

Updated for Swift 4.2 Requires Xcode 10 and Swift 4.2. Installation Drop in the Spring folder to your Xcode project (make sure to enable "Copy items i

Meng To 14k Jan 3, 2023
Better Easing for SpriteKit in Swift

This easing library began life as a port of buddingmonkey's Objective C SpriteKit Easing library to Swift. This library extends upon the basic easing

Craig Grummitt 110 Dec 17, 2022
Swift library for choreographing animations on the screen.

Spruce iOS Animation Library (and Android) What is it? Spruce is a lightweight animation library that helps choreograph the animations on the screen.

WillowTree, LLC 3.4k Jan 3, 2023
A fantastic Physical animation library for swift

A fantastic Physical animation library for swift(Not Just Spring !!!), it is base on UIDynamic and extension to it, friendly APIs make you use it or c

August 2.9k Jan 4, 2023
A slider widget with a popup bubble displaying the precise value selected written on Swift.

A slider widget with a popup bubble displaying the precise value selected written on Swift. We specialize in the designing and coding of

Ramotion 1.9k Dec 23, 2022
Navigation toolbar is a Swift slide-modeled UI navigation controller.

Navigation toolbar is a Swift slide-modeled UI navigation controller. We specialize in the designing and coding of custom UI for Mo

Ramotion 596 Nov 17, 2022
Animate easy and with less code with Swift

JDAnimationKit is designed to be extremely easy to use. You can animate your UI withe less lines of code. This library use internally POP framework, a

Jelly Development 610 Sep 9, 2022