•  


GitHub - liam-i/FlyHUD: A lightweight and easy-to-use HUD for iOS and tvOS apps.
Skip to content

liam-i/FlyHUD

Repository files navigation

FlyHUD: Easy-to-use HUD in Swift FlyHUD: Easy-to-use HUD in Swift

Swift Platforms CocoaPods SPM Carthage Doc License

English | ??中文

This is a lightweight and easy-to-use HUD designed to display the progress and status of ongoing tasks on iOS and tvOS.

ScreenShots

Requirements

  • iOS 12.0+
  • tvOS 12.0+
  • Xcode 14.1+
  • Swift 5.7.1+

Installation

Swift Package Manager

...using swift build

If you are using the Swift Package Manager , add a dependency to your Package.swift file and import the HUD library into the desired targets:

dependencies: 
[

    .
package
(
url
:
 "
https://github.com/liam-i/FlyHUD.git
"
,
 from
:
 "
1.5.12
"
)

]
,

targets: 
[

    .
target
(

        name
:
 "
MyTarget
"
,
 dependencies
:
 [

            .
product
(
name
:
 "
FlyHUD
"
,
 package
:
 "
FlyHUD
"
)
,
         // Optional

            .
product
(
name
:
 "
FlyProgressHUD
"
,
 package
:
 "
FlyHUD
"
)
,
 // Optional

            .
product
(
name
:
 "
FlyIndicatorHUD
"
,
 package
:
 "
FlyHUD
"
)
 // Optional

        ]
)

]

...using Xcode

If you are using Xcode, then you should:

  • File > Swift Packages > Add Package Dependency
  • Add https://github.com/liam-i/FlyHUD.git
  • Select "Up to Next Minor" with "1.5.12"

Tip

For detailed tutorials, see: Apple Docs

CocoaPods

If you're using CocoaPods , add this to your Podfile :

source
 'https://github.com/CocoaPods/Specs.git'

# Or use CND source

# source 'https://cdn.cocoapods.org/'

platform
 :ios
,
 '12.0'

use_frameworks!


target
 'MyApp'
 do

  # Use the FlyHUD, FlyIndicatorHUD and FlyProgressHUD components.

  pod
 'FlyHUD'
,
 '~> 1.5.12'


  # Or, just use the FlyHUD component.

  pod
 'FlyHUD'
,
 '~> 1.5.12'
,
 :subspecs
 =>
 [
'FlyHUD'
]


  # Or, just use the FlyHUD and FlyIndicatorHUD components.

  pod
 'FlyHUD'
,
 '~> 1.5.12'
,
 :subspecs
 =>
 [
'FlyIndicatorHUD'
]


  # Or, just use the FlyHUD and FlyProgressHUD components.

  pod
 'FlyHUD'
,
 '~> 1.5.12'
,
 :subspecs
 =>
 [
'FlyProgressHUD'
]

end

And run pod install .

Important

CocoaPods 1.13.0 or newer is required.

Carthage

If you're using Carthage , add this to your Cartfile :

github
 "liam-i/FlyHUD"
 ~> 
1.5
.
12

And run carthage update --platform iOS --use-xcframeworks .

Usage

Using HUD in your application is very simple.

  • Displays the status HUD of an indeterminate tasks:
let
 hud
 =
 HUD
.
show
(
to
:
 view
)

DispatchQueue
.
global
(
)
.
async
 {

    // Do something...

    DispatchQueue
.
main
.
async
 {

        hud
.
hide
(
)

    }

}
  • Displays a task's progress HUD:
let
 hud
 =
 HUD
.
show
(
to
:
 view
,
 mode
:
 .
progress
(
)
,
 label
:
 "
Loading
"
)

Task
.
request
 {
 progress 
in

    hud
.
progress 
=
 progress
}
 completion
:
 {

    hud
.
hide
(
)

}
  • Displays a text-only status HUD:
HUD
.
showStatus
(
to
:
 view
,
 label
:
 "
Wrong password
"
)
  • Displays a custom view's status HUD. e.g. a UIImageView:
HUD
.
showStatus
(
to
:
 view
,
 mode
:
 .
custom
(
UIImageView
(
image
:
 UIImage
(
named
:
 "
Checkmark
"
)
?
.
withRenderingMode
(
.
alwaysTemplate
)
)
)
,
 label
:
 "
Completed
"
)
  • Displays a custom view's status HUD. And the UIImageView is on the left:
HUD
.
showStatus
(
to
:
 view
,
 mode
:
 .
custom
(
UIImageView
(
image
:
 UIImage
(
named
:
 "
warning
"
)
)
)
,
 label
:
 "
You have an unfinished task.
"
)
 {

    $0
.
contentView
.
indicatorPosition 
=
 .
leading
}
  • Sets the animation that should be used when showing and hiding the HUD. E.g. style, duration, spring damping:
HUD
.
showStatus
(
to
:
 view
,
 using
:
 .
animation
(
.
slideUpDown
,
 damping
:
 .
default
,
 duration
:
 0.3
)
,
 label
:
 "
Wrong password
"
)
  • Enable keyboard layout guide to track the keyboard's position in your app’s layout:
HUD
.
showStatus
(
to
:
 view
,
 label
:
 "
You have a message.
"
)
 {

    $0
.
keyboardGuide 
=
 .
center
(
)

}

Warning

HUD is a UI class and should therefore only be accessed on the main thread.

For more examples, including how to use the HUD with asynchronous operations such as URLSession, and how to customize the HUD style, take a look at the bundled example project. Extensive API documentation is available here .

To run the example project, first clone the repo, then cd to the root directory and run pod install . Then open HUD.xcworkspace in Xcode.

Documentation

The documentation for releases and main are available here:

Other versions

Why the name FlyHUD?

The name FlyHUD combines Fly and HUD and stands out for its simplicity and expressiveness. Fly implies fast, efficient and flexible meaning, which is consistent with the real-time and immediacy of HUD . Overall, FlyHUD expresses the ability of HUD to present information and data quickly and efficiently.

Credits and thanks

License

FlyHUD is available under the MIT license. See the LICENSE file for more info.

- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본