GithubHelp home page GithubHelp logo

honkmaster / ttprogresshud Goto Github PK

View Code? Open in Web Editor NEW
233.0 4.0 25.0 158 KB

TTProgressHUD is a light weight HUD written in SwiftUI meant to display the progress of an ongoing task on iOS.

Home Page: https://github.com/honkmaster/TTProgressHUD

License: MIT License

Swift 100.00%
ios swiftui swift5

ttprogresshud's Introduction

TTProgressHUD

TTProgressHUD is a light weight HUD written in SwiftUI meant to display the progress of an ongoing task on iOS. TTProgressHUD (left) was designed to look as similar as possible to the Apple HUD (example from Podcast.app, right).

Installation

Xcode 11 and iOS 13 is required.

Swift Package Manager

Manually

Drag TTProgressHUD.swift and TTProgressHUDConfig.swift into your project.

Usage

Use TTProgressHUD wisely! Only use it if you absolutely need to perform a task before taking the user forward. Bad use case examples: pull to refresh, infinite scrolling, sending message.

Import

Import the TTProgressHUD package:

import TTProgressHUD

Instantiate and show the HUD view

struct ContentView: View {
    @State var hudVisible = true
    @State var hudConfig = TTProgressHUDConfig()
    
    var body: some View {
        TTProgressHUD($hudVisible, config: hudConfig)
    }
}

Customization

TTProgressHUD can be customized via the TTProgressHUDConfig struct. The default values were chosen so that TTProgressHUD looks as similar as possible to the Apple HUD.

public init(
    type: TTProgressHUDType         = .loading,
    title: String?                  = nil,
    caption: String?                = nil,
    minSize: CGSize                 = CGSize(width: 100.0, height: 100.0),
    cornerRadius: CGFloat           = 12.0,
    backgroundColor: Color          = .clear,
    foregroundColor: Color          = Color(.systemBackground),
    titleForegroundColor: Color     = .primary,
    captionForegroundColor: Color   = .secondary,
    shadowColor: Color              = .clear,
    shadowRadius: CGFloat           = 0.0,
    borderColor: Color              = .clear,
    borderWidth: CGFloat            = 0.0,
    lineWidth: CGFloat              = 10.0,
    imageViewSize: CGSize           = CGSize(width: 100, height: 100),
    imageViewForegroundColor: Color = .primary,
    successImage: String            = "checkmark.circle",
    warningImage: String            = "exclamationmark.circle",
    errorImage: String              = "xmark.circle",
    shouldAutoHide: Bool            = false,
    allowsTapToHide: Bool           = false,
    autoHideInterval: TimeInterval  = 10.0,
    hapticsEnabled: Bool            = true
){...}

Haptic Feedback

TTProgressHUD will automatically trigger haptic feedback depending on which HUD is being displayed. The feedback maps as follows:

  • TTProgressHUDType.success <-> UINotificationFeedbackTypeSuccess
  • TTProgressHUDType.warning <-> UINotificationFeedbackTypeWarning
  • TTProgressHUDType.error <-> UINotificationFeedbackTypeError

Contributing to this project

If you have feature requests or bug reports, feel free to help out by sending pull requests or by creating new issues. Please take a moment to review the guidelines written by Nicolas Gallagher:

License

TTProgressHUD is distributed under the terms and conditions of the MIT license.

Credits

TTProgressHUD is brought to you by Tobias Tiemerding and based on SVProgressHUD. If you're using TTProgressHUD in your project, attribution would be very appreciated.

ttprogresshud's People

Contributors

bonebox avatar hartbit avatar honkmaster avatar pablogeek avatar yimajo 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

ttprogresshud's Issues

Title customization

I really like this library, except for the text. Right now the font is a bit large and limited to 1 or 2 lines depending on the label, and I wish it had a bit more flexibility. A way to change the font size, or the line limit, or both. Is this something you would be interested in allowing as a configuration option?

Showing All Messages Failed to resolve dependencies

Xcode Version 11.7 (11E801a)
SwiftUI project target iOS 13.0

while add Swift Package Dependency, show error below:

because every version of TTProgressHUD contains incompatible tools version and root depends on TTProgressHUD 0.0.2..<1.0.0, version solving failed.

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.