pkhud

Introduction

Welcome to PKHUD!

PKHUD is a lightweight and versatile iOS framework for creating beautiful and intuitive HUDs (head-up displays) in your apps. It provides a simple and convenient way to display temporary messages, loading indicators, progress bars, and other visual feedback to enhance user experience.

Features

  • Easy-to-use and customizable HUD components
  • Support for displaying messages, labels, and images
  • Various built-in animation effects
  • Support for custom animations and transitions
  • Flexible configuration options
  • Lightweight and optimized for performance

Installation

PKHUD can be easily installed using the Cocoapods dependency manager. To integrate it into your project, follow these steps:

Step 1: Cocoapods

source 'https://cdn.cocoapods.org/'
platform :ios, '10.0'

target 'YourProjectName' do
  use_frameworks!
  pod 'PKHUD'
end

Step 2: Install and Update Dependencies

$ pod install

Step 3: Import

import PKHUD

Usage

PKHUD provides a straightforward API for creating and displaying HUDs. Follow these steps to use PKHUD in your app:

Step 1: Show a HUD

PKHUD.sharedHUD.contentView = PKHUDSystemActivityIndicatorView()
PKHUD.sharedHUD.show()

Step 2: Customize HUD

// Configure appearance
PKHUD.sharedHUD.effect = PKHUDEffectType.fade
PKHUD.sharedHUD.backgroundColor = UIColor(white: 0.1, alpha: 0.9)

// Customize the HUD content view
let titleLabel = UILabel()
titleLabel.text = "Loading..."
titleLabel.textColor = UIColor.white
PKHUD.sharedHUD.contentView = titleLabel

// Show the HUD
PKHUD.sharedHUD.show()

Step 3: Hide the HUD

PKHUD.sharedHUD.hide(afterDelay: 2.0)

Advanced Usage

PKHUD offers advanced features and customization options. Here are some examples:

Custom Views

You can use custom views within PKHUD as a content view. Here’s an example:

// Create a custom view (e.g., a UIImageView)
let imageView = UIImageView(image: UIImage(named: "custom_image"))

// Set the custom view as the content view
PKHUD.sharedHUD.contentView = imageView

// Show the HUD
PKHUD.sharedHUD.show()

Custom Animations

PKHUD allows you to define custom animations using the PKHUDAnimating protocol. Follow these steps to create a custom animation:

class MyCustomAnimation: PKHUDAnimating {
  // Implement the necessary methods
  ...
}

// Assign the custom animation to the HUD
PKHUD.sharedHUD.animation = MyCustomAnimation()

// Show the HUD
PKHUD.sharedHUD.show()

Documentation and Resources

For more information on using PKHUD and to explore its complete API reference, please refer to the official PKHUD documentation:


PKHUD Documentation

Support

If you have any questions, issues, or feature requests related to PKHUD, please reach out to our dedicated support team:


support@pkhud.com

License

PKHUD is released under the MIT License. For more details, see the LICENSE file included with the framework.