Giter Club home page Giter Club logo

apesuperhud's Introduction

APESuperHUD

A simple way to display a HUD with a message or progress information in your application.

APESuperHUD

Features

  • Simplicity.
  • Customizable. See Change appearance.
  • Fully written in Swift.
  • Unit tests.

Requirements

  • iOS 9 or later.
  • Xcode 9 (Swift 4.1) or later.
    • For Swift 3.0 use version 1.1.3
    • For Swift 2.2 use version 0.6

Installation

CocoaPods

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

platform :ios, '9.0'
use_frameworks!

target 'MyApp' do
    pod 'APESuperHUD', :git => 'https://github.com/apegroup/APESuperHUD.git'
end

Note that this requires CocoaPods version 36, and your iOS deployment target to be at least 9.0:

Carthage

You can use Carthage to install APESuperHUD by adding it to your Cartfile:

github "apegroup/APESuperHUD"

Usage

Don't forget to import.

import APESuperHUD

Show hud with icon

let image = UIImage(named: "apegroup")!
APESuperHUD.show(style: .icon(image: image, duration: 3.0), title: "Hello", message: "world")

// Or create a instance of APESuperHud

/*
let hudViewController = APESuperHUD(style: .icon(image: image, duration: 3), title: "Hello", message: "world")
present(hudViewController, animated: true)
*/

Show hud with loading indicator

APESuperHUD.show(style: .loadingIndicator(type: .standard), title: nil, message: "Loading...")

DispatchQueue.main.asyncAfter(deadline: .now() + 3.0, execute: {
    APESuperHUD.dismissAll(animated: true)
})

// Or create a instance of APESuperHud

/*
let hudViewController = APESuperHUD(style: .loadingIndicator(type: .standard), title: nil, message: "Loading...")
present(hudViewController, animated: true)

DispatchQueue.main.asyncAfter(deadline: .now() + 3.0, execute: {
    hudViewController.dismiss(animated: true)
})
*/

Show hud with title and message

APESuperHUD.show(style: .textOnly, title: "Hello", message: "world")

DispatchQueue.main.asyncAfter(deadline: .now() + 3.0, execute: {
    APESuperHUD.dismissAll(animated: true)
})

// Or create a instance of APESuperHud

/*
let hudViewController = APESuperHUD(style: .textOnly, title: "Hello", message: "world")
present(hudViewController, animated: true)

DispatchQueue.main.asyncAfter(deadline: .now() + 3.0, execute: {
    hudViewController.dismiss(animated: true)
})
*/

Show hud with updates

APESuperHUD.show(style: .loadingIndicator(type: .standard), title: nil, message: "Loading...")

DispatchQueue.main.asyncAfter(deadline: .now() + 3.0, execute: {
    APESuperHUD.show(style: .textOnly, title: "Done loading", message: nil)

    DispatchQueue.main.asyncAfter(deadline: .now() + 3.0, execute: {
        let image = UIImage(named: "apegroup")!
        APESuperHUD.show(style: .icon(image: image, duration: 3.0), title: nil, message: nil)
    })
})

Change appearance

/// Text color of the title text inside the HUD
HUDAppearance.titleTextColor = UIColor.black

/// Text color of the message text inside the HUD
HUDAppearance.messageTextColor = UIColor.black

/// The color of the icon in the HUD
HUDAppearance.iconColor = UIColor.black

/// The background color of the view where the HUD is presented
HUDAppearance.backgroundColor = UIColor.black.withAlphaComponent(0.5)

/// The background color of the HUD view
HUDAppearance.foregroundColor = UIColor.white

/// The color of the loading indicator
HUDAppearance.loadingActivityIndicatorColor = UIColor.gray

/// The corner radius of the HUD
HUDAppearance.cornerRadius = 10.0

/// Enables/disables shadow effect around the HUD
HUDAppearance.shadow = true

/// The shadow color around the HUD
HUDAppearance.shadowColor = UIColor.black

/// The shadow offset around the HUD
HUDAppearance.shadowOffset = CGSize(width: 0, height: 0)

/// The shadow radius around the HUD
HUDAppearance.shadowRadius = 6.0

/// The shadow opacity around the HUD
HUDAppearance.shadowOpacity = 0.15

/// Enables/disables removal of the HUD if the user taps on the screen
HUDAppearance.cancelableOnTouch = true

/// The info message font in the HUD
HUDAppearance.messageFont = UIFont.systemFont(ofSize: 13, weight: .regular)

/// The title font in the HUD
HUDAppearance.titleFont = UIFont.systemFont(ofSize: 20, weight: .bold)

/// The size of the icon inside the HUD
HUDAppearance.iconSize = CGSize(width: 48, height: 48)

/// The HUD size
HUDAppearance.hudSize = CGSize(width: 144, height: 144)

/// The HUD fade in duration
HUDAppearance.animateInTime = 0.7

/// The HUD fade out duration
HUDAppearance.animateOutTime = 0.7

Contributing

All people are welcome to contribute. See CONTRIBUTING for details.

License

APESuperHUD is released under the MIT license. See LICENSE for details.

apesuperhud's People

Contributors

binarydennis avatar danielnilssongithub avatar efagerman avatar erifa avatar mixo44 avatar readmecritic avatar sudeepsidhu avatar varshasingh1512 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apesuperhud's Issues

I can not use on Swift 4.2

I discovered the problem in the show function and dismissAll. compactMap is no longer supported.

Thanks!!

Addition

Hello. Thank you for the framework. It works good.
Please, can you add a functions which shows weather the HudView is visible on the given view or not.
Like this:

public static func isVisible(in view: UIView) -> Bool {
        
        var status = false
        if getHudView(presentingView: view) != nil {
            
            status = true
        }
        
        return status
}

Thanks!

Ability to change the loadingActivityIndicator size

Hi there,

Thanks for this great and flexible HUD. One thing I'd love to adjust though is the size of the loadingActivityIndicator. I'm not using the title or message so the loadingActivityIndicator looks a little small on its own.
I've noticed you are using the default loadingActivityIndicator and I know it's not very customizable but there are some SO posts that show how to adjust the size of the native loadingActivityIndicator:

activityIndicator.transform = CGAffineTransform(scaleX: 2, y: 2)
https://stackoverflow.com/questions/2638120/can-i-change-the-size-of-uiactivityindicator

It's an easy way of making the loadingActivityIndicator bigger even though the loadingActivityIndicator appears a little blurry.

Eventually that'd be better I guess to have this loadingActivityIndicator a custom animation like they do in https://github.com/SVProgressHUD/SVProgressHUD for example.

Cheers and have a great weekend!

progress display?

Perhaps i am just missing it, but there seems to be no built-in ability to show a progress of (for example), a web view loading.

Hopefully i am wrong?

Can build app anymore

Keep getting these errors:
APESuperHUD/Source/HudView.swift:403:71: Type 'UILayoutPriority' (aka 'Float') has no member 'RawValue'

APESuperHUD/Source/HudView.swift:468:66: Type 'UILayoutPriority' (aka 'Float') has no member 'required'

APESuperHUD/Source/HudView.swift:402:63: Type 'UILayoutPriority' (aka 'Float') has no member 'RawValue'

APESuperHUD/Source/HudView.swift:453:60: Type 'UILayoutPriority' (aka 'Float') has no member 'required'

AppStore Submit Issue

When I try to upload App Store, I get to following error.
PS I use carthage.

Thanks for your support.

2016-08-25 13:27:26 +0000 [MT] Presenting: Error Domain=DVTFoundationNSBundleAdditionsErrorDomain Code=1 "Couldn't find platform family in Info.plist CFBundleSupportedPlatforms or Mach-O LC_VERSION_MIN for APESuperHUD" UserInfo={NSLocalizedDescription=Couldn't find platform family in Info.plist CFBundleSupportedPlatforms or Mach-O LC_VERSION_MIN for APESuperHUD}

Ambigous reference

Hi,

When I'm trying to display message, I got this :
capture d ecran 2016-09-16 a 11 39 43

With 0.6 version and cocoapod. Have you any solution ?

Thank you !

iOS 10 backgroundBlurEffect issue

Hello,

Since iOS 10 update, I found issue with backgroundBlurEffect property. The background seem to appear blurred / un blurred / blurred when the loader appear.

To reproduce this issue, just replace in the demo project
APESuperHUD.appearance.backgroundBlurEffect = .none
by :
APESuperHUD.appearance.backgroundBlurEffect = .dark

Have you any solution for this issue ? :)

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.