[Swift5] How to implement standby screen using'PKHUD'

What is PKHUD

** PKHUD ** is a library for displaying ** HUD (Head-Up Display) **. You can use the HUD to tell the user that something is happening or completed.

PKHUD can be installed using either CocoaPods or Carthage. In this article, I will introduce using CocoaPods.

Library installation

//Describe the following pod in the Podfile'pod install'In the terminal
pod 'PKHUD'

//Import to the file you want to use PKHUD
import PKHUD

Code introduction

==================================================================
① Basic usage
//Display of loading
HUD.show(.progress)

//Hide loading
HUD.hide(animation: true)
==================================================================

==================================================================
② Success/Display of failure
//Show success
HUD.flash(.success)

//Display of failure
HUD.flash(.error)
==================================================================

==================================================================
③ Loading / success / failure display (with text)
//Display loading by specifying text
HUD.show(.labelProgress(title: "Write text here", subtitle: nil))

//Specify text to show success
HUD.flash(.labeledSuccess(title: "Success", subtitle: nil))

//Show failure by specifying text
HUD.flash(.labeledError(title: "Error", subtitle: nil))
==================================================================

==================================================================
④ Display only in text
HUD.show(.label("Write text here"))
==================================================================

Disable mask

By default, the background view of the HUD will be dimmed and users will not be able to interact with the app during that time. However, there may be situations where you want the user to be able to operate it. I will also digest the implementation method in such cases.

//Allows you to manipulate the background view of the HUD
HUD.allowsInteraction = true

//Do not darken the background view of the HUD
HUD.dimsBackground = false

please refer!

Recommended Posts

[Swift5] How to implement standby screen using'PKHUD'
[Swift] How to implement the countdown function
[Swift5] How to create a splash screen
[Swift5] How to implement animation using "lottie-ios"
[Swift] How to implement the LINE login function
[swift5] How to implement the Twitter share function
[Swift] How to implement the fade-in / out function
How to implement UICollectionView in Swift with code only
[Swift] How to use UserDefaults
How to use Swift UIScrollView
[Rails] How to implement scraping
[Java] How to implement multithreading
How to transition from the [Swift5] app to the iPhone settings screen
How to implement infinite scrolling (page nate) in Swift TableView
[Rails] How to prevent screen transition
[Swift] How to use SwiftLint (cocoapods)
[Swift] How to use Unwind segue
[Swift] How to send a notification
[Rails] How to implement star rating
[Swift] How to replace multiple strings
[Swift] How to implement the Twitter login function using Firebase UI ①
[Swift] How to implement the Twitter login function using Firebase UI ②
[swift5] How to specify color in hexadecimal
How to implement search functionality in Rails
How to implement date calculation in Java
[Swift] How to fix Label in UIPickerView
[Swift] How to use Tab Bar Controller
How to call Swift 5.3 code from Objective-C
[Swift] Easy to implement modal with PanModal
How to implement coding conventions in Java
How to implement TextInputLayout with validation function
How to pass the value to another screen
How to implement ranking functionality in Rails
How to implement image posting using rails
How to implement asynchronous processing in Outsystems
How to overwrite Firebase data in Swift
[Swift] How to use one option alert
Swift beginners tried to implement microwave logic!
[Rails] How to implement unit tests for models
How to add sound in the app (swift)
How to implement the breadcrumb function using gretel
[Swift] How to link the app with Firebase
[For beginners] How to implement the delete function
How to implement a like feature in Rails
[Swift UI] How to disable ScrollsToTop of ScrollView
[Rails] How to easily implement numbers with pull-down
How to implement optimistic locking in REST API
[Java] 4 steps to implement splash screen on Android
How to execute tasks in parallel in Swift in Swift Package
How to implement Pagination in GraphQL (for ruby)
How to implement login request processing (Rails / for beginners)
[Swift] How to play songs from your music library
How to implement guest login in 5 minutes in rails portfolio
How to implement a like feature in Ajax in Rails
How to return to the previous screen by Swipe operation
How to send value in HTML without screen transition
[Rails, JS] How to implement asynchronous display of comments
How to move to the details screen by clicking the image
[Android Studio] [Java] How to fix the screen vertically
How to test file upload screen in Spring + Selenium
[swift5] How to execute processing when tabBar is tapped