提交
21
Pods/SVProgressHUD/LICENSE
generated
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2011-2023 Sam Vermette, Tobias Totzek and contributors.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
221
Pods/SVProgressHUD/README.md
generated
Normal file
@@ -0,0 +1,221 @@
|
||||
# SVProgressHUD
|
||||
|
||||

|
||||

|
||||

|
||||
[](https://swift.org/package-manager/)
|
||||
[](https://cocoapods.org)
|
||||
[](https://github.com/Carthage/Carthage)
|
||||
|
||||
`SVProgressHUD` is a clean and easy-to-use HUD meant to display the progress of an ongoing task on iOS and tvOS.
|
||||
|
||||

|
||||
|
||||
## Installation
|
||||
|
||||
### Swift Package Manager
|
||||
|
||||
[Swift Package Manager](https://swift.org/package-manager/) (SwiftPM) is a tool for managing the distribution of Swift code. It simplifies the process of managing Swift package dependencies.
|
||||
|
||||
To integrate `SVProgressHUD` into your project using SwiftPM:
|
||||
|
||||
1. In Xcode, select **File > Add Package Dependency**.
|
||||
2. Enter the following package repository URL: https://github.com/SVProgressHUD/SVProgressHUD.git
|
||||
3. Choose the appropriate version (e.g. a specific version, branch, or commit).
|
||||
4. Add `SVProgressHUD` to your target dependencies.
|
||||
|
||||
`SVProgressHUD` requires at least Swift tools version 5.3.
|
||||
|
||||
### From CocoaPods
|
||||
|
||||
[CocoaPods](http://cocoapods.org) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like `SVProgressHUD` in your projects. First, add the following line to your [Podfile](http://guides.cocoapods.org/using/using-cocoapods.html):
|
||||
|
||||
```ruby
|
||||
pod 'SVProgressHUD'
|
||||
```
|
||||
|
||||
If you want to use the latest features of `SVProgressHUD` use normal external source dependencies.
|
||||
|
||||
```ruby
|
||||
pod 'SVProgressHUD', :git => 'https://github.com/SVProgressHUD/SVProgressHUD.git'
|
||||
```
|
||||
|
||||
This pulls from the `master` branch directly.
|
||||
|
||||
Second, install `SVProgressHUD` into your project:
|
||||
|
||||
```ruby
|
||||
pod install
|
||||
```
|
||||
|
||||
### Carthage
|
||||
|
||||
[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate `SVProgressHUD` into your Xcode project using Carthage, specify it in your `Cartfile`:
|
||||
|
||||
```ogdl
|
||||
github "SVProgressHUD/SVProgressHUD"
|
||||
```
|
||||
|
||||
Run `carthage bootstrap` to build the framework in your repository's Carthage directory. You can then include it in your target's `carthage copy-frameworks` build phase. For more information on this, please see [Carthage's documentation](https://github.com/carthage/carthage#if-youre-building-for-ios-tvos-or-watchos).
|
||||
|
||||
### Manually
|
||||
|
||||
* Drag the `SVProgressHUD/SVProgressHUD` folder into your project.
|
||||
* Take care that `SVProgressHUD.bundle` is added to `Targets->Build Phases->Copy Bundle Resources`.
|
||||
* Add the **QuartzCore** framework to your project.
|
||||
|
||||
## Swift
|
||||
|
||||
Even though `SVProgressHUD` is written in Objective-C, it can be used in Swift with no hassle.
|
||||
|
||||
If you use [CocoaPods](http://cocoapods.org) add the following line to your [Podfile](http://guides.cocoapods.org/using/using-cocoapods.html):
|
||||
|
||||
```ruby
|
||||
use_frameworks!
|
||||
```
|
||||
|
||||
If you added `SVProgressHUD` manually, just add a [bridging header](https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html) file to your project with the `SVProgressHUD` header included.
|
||||
|
||||
## Usage
|
||||
|
||||
(see sample Xcode project in `/Demo`)
|
||||
|
||||
`SVProgressHUD` is created as a singleton (i.e. it doesn't need to be explicitly allocated and instantiated; you directly call `[SVProgressHUD method]` / `SVProgressHUD.method()`).
|
||||
|
||||
**Use `SVProgressHUD` 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.**
|
||||
|
||||
Using `SVProgressHUD` in your app will usually look as simple as this.
|
||||
|
||||
**Objective-C:**
|
||||
|
||||
```objective-c
|
||||
[SVProgressHUD show];
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
// time-consuming task
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[SVProgressHUD dismiss];
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
**Swift:**
|
||||
|
||||
```swift
|
||||
SVProgressHUD.show()
|
||||
DispatchQueue.global(qos: .default).async {
|
||||
// time-consuming task
|
||||
DispatchQueue.main.async {
|
||||
SVProgressHUD.dismiss()
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Showing the HUD
|
||||
|
||||
You can show the status of indeterminate tasks using one of the following:
|
||||
|
||||
```objective-c
|
||||
+ (void)show;
|
||||
+ (void)showWithStatus:(NSString*)string;
|
||||
```
|
||||
|
||||
If you'd like the HUD to reflect the progress of a task, use one of these:
|
||||
|
||||
```objective-c
|
||||
+ (void)showProgress:(CGFloat)progress;
|
||||
+ (void)showProgress:(CGFloat)progress status:(NSString*)status;
|
||||
```
|
||||
|
||||
### Dismissing the HUD
|
||||
|
||||
The HUD can be dismissed using:
|
||||
|
||||
```objective-c
|
||||
+ (void)dismiss;
|
||||
+ (void)dismissWithDelay:(NSTimeInterval)delay;
|
||||
```
|
||||
|
||||
If you'd like to stack HUDs, you can balance out every show call using:
|
||||
|
||||
```
|
||||
+ (void)popActivity;
|
||||
```
|
||||
|
||||
The HUD will get dismissed once the `popActivity` calls will match the number of show calls.
|
||||
|
||||
Or show an image with status before getting dismissed a little bit later. The display time depends on `minimumDismissTimeInterval` and the length of the given string.
|
||||
|
||||
```objective-c
|
||||
+ (void)showInfoWithStatus:(NSString*)string;
|
||||
+ (void)showSuccessWithStatus:(NSString*)string;
|
||||
+ (void)showErrorWithStatus:(NSString*)string;
|
||||
+ (void)showImage:(UIImage*)image status:(NSString*)string;
|
||||
```
|
||||
|
||||
## Customization
|
||||
|
||||
`SVProgressHUD` is designed with flexibility in mind, providing a myriad of customization options to fit the look and feel of your application seamlessly.
|
||||
|
||||
* Appearance: Make use of the `UI_APPEARANCE_SELECTOR` to adjust styles, colors, fonts, size, and images app-wide.
|
||||
* Behavior: Control visibility durations, display delays, and animation speeds.
|
||||
* Feedback: Enhance the user experience with options for haptic feedback and motion effects.
|
||||
|
||||
For a comprehensive list of properties and detailed explanations, refer to the `SVProgressHUD.h` file in the API documentation.
|
||||
|
||||
### Hint
|
||||
|
||||
As standard `SVProgressHUD` offers three preconfigured styles:
|
||||
|
||||
* `SVProgressHUDStyleAutomatic`: Automatically switch between the light and dark style
|
||||
* `SVProgressHUDStyleLight`: White background with black spinner and text
|
||||
* `SVProgressHUDStyleDark`: Black background with white spinner and text
|
||||
|
||||
If you want to use custom colors use `setForegroundColor:` and/or `setBackgroundColor:`. These implicitly set the HUD's style to `SVProgressHUDStyleCustom`.
|
||||
|
||||
## Haptic Feedback
|
||||
|
||||
Available on iPhone 7 and newer, `SVProgressHUD` can automatically trigger haptic feedback depending on which HUD is being displayed. The feedback maps as follows:
|
||||
|
||||
* `showSuccessWithStatus:` <-> `UINotificationFeedbackTypeSuccess`
|
||||
* `showInfoWithStatus:` <-> `UINotificationFeedbackTypeWarning`
|
||||
* `showErrorWithStatus:` <-> `UINotificationFeedbackTypeError`
|
||||
|
||||
To enable this functionality, use `setHapticsEnabled:`.
|
||||
|
||||
## Notifications
|
||||
|
||||
`SVProgressHUD` posts four notifications via `NSNotificationCenter` in response to being shown/dismissed:
|
||||
|
||||
* `SVProgressHUDWillAppearNotification` when the show animation starts
|
||||
* `SVProgressHUDDidAppearNotification` when the show animation completes
|
||||
* `SVProgressHUDWillDisappearNotification` when the dismiss animation starts
|
||||
* `SVProgressHUDDidDisappearNotification` when the dismiss animation completes
|
||||
|
||||
Each notification passes a `userInfo` dictionary holding the HUD's status string (if any), retrievable via `SVProgressHUDStatusUserInfoKey`.
|
||||
|
||||
`SVProgressHUD` also posts `SVProgressHUDDidReceiveTouchEventNotification` when users touch on the overall screen or `SVProgressHUDDidTouchDownInsideNotification` when a user touches on the HUD directly. For these notifications `userInfo` is not passed but the object parameter contains the `UIEvent` that related to the touch.
|
||||
|
||||
## App Extensions
|
||||
|
||||
When using `SVProgressHUD` in an App Extension, `#define SV_APP_EXTENSIONS` to avoid using unavailable APIs. This will be done automatically when using the `AppExtension` CocoaPods subspec. Additionally, call `setViewForExtension:` from your extensions view controller with `self.view`.
|
||||
|
||||
## 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](https://github.com/SVProgressHUD/SVProgressHUD/issues/new). Please take a moment to
|
||||
review the guidelines written by [Nicolas Gallagher](https://github.com/necolas):
|
||||
|
||||
* [Bug reports](https://github.com/necolas/issue-guidelines/blob/master/CONTRIBUTING.md#bugs)
|
||||
* [Feature requests](https://github.com/necolas/issue-guidelines/blob/master/CONTRIBUTING.md#features)
|
||||
* [Pull requests](https://github.com/necolas/issue-guidelines/blob/master/CONTRIBUTING.md#pull-requests)
|
||||
|
||||
## License
|
||||
|
||||
`SVProgressHUD` is distributed under the terms and conditions of the [MIT license](https://github.com/SVProgressHUD/SVProgressHUD/blob/master/LICENSE). The success, error and info icons used on iOS 12 are made by [Freepik](http://www.freepik.com) from [Flaticon](https://www.flaticon.com) and are licensed under [Creative Commons BY 3.0](https://creativecommons.org/licenses/by/3.0/).
|
||||
|
||||
## Privacy
|
||||
|
||||
`SVProgressHUD` does not collect any data. A [privacy manifest file](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files) is [provided](SVProgressHUD/PrivacyInfo.xcprivacy).
|
||||
|
||||
## Credits
|
||||
|
||||
`SVProgressHUD` is brought to you by Sam Vermette, [Tobias Totzek](https://totzek.me) and [contributors to the project](https://github.com/SVProgressHUD/SVProgressHUD/contributors). If you're using `SVProgressHUD` in your project, attribution would be very appreciated.
|
||||
14
Pods/SVProgressHUD/SVProgressHUD/PrivacyInfo.xcprivacy
generated
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrivacyTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypes</key>
|
||||
<array/>
|
||||
<key>NSPrivacyTrackingDomains</key>
|
||||
<array/>
|
||||
<key>NSPrivacyAccessedAPITypes</key>
|
||||
<array/>
|
||||
</dict>
|
||||
</plist>
|
||||
17
Pods/SVProgressHUD/SVProgressHUD/SVIndefiniteAnimatedView.h
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// SVIndefiniteAnimatedView.h
|
||||
// SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
|
||||
//
|
||||
// Copyright (c) 2014-2023 Guillaume Campagna and contributors. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface SVIndefiniteAnimatedView : UIView
|
||||
|
||||
@property (nonatomic, assign) CGFloat strokeThickness;
|
||||
@property (nonatomic, assign) CGFloat radius;
|
||||
@property (nonatomic, strong) UIColor *strokeColor;
|
||||
|
||||
@end
|
||||
|
||||
142
Pods/SVProgressHUD/SVProgressHUD/SVIndefiniteAnimatedView.m
generated
Normal file
@@ -0,0 +1,142 @@
|
||||
//
|
||||
// SVIndefiniteAnimatedView.m
|
||||
// SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
|
||||
//
|
||||
// Copyright (c) 2014-2023 Guillaume Campagna and contributors. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SVIndefiniteAnimatedView.h"
|
||||
#import "SVProgressHUD.h"
|
||||
|
||||
@interface SVIndefiniteAnimatedView ()
|
||||
|
||||
@property (nonatomic, strong) CAShapeLayer *indefiniteAnimatedLayer;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SVIndefiniteAnimatedView
|
||||
|
||||
- (void)willMoveToSuperview:(UIView*)newSuperview {
|
||||
if (newSuperview) {
|
||||
[self layoutAnimatedLayer];
|
||||
} else {
|
||||
[_indefiniteAnimatedLayer removeFromSuperlayer];
|
||||
_indefiniteAnimatedLayer = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)layoutSubviews {
|
||||
[super layoutSubviews];
|
||||
|
||||
[self layoutAnimatedLayer];
|
||||
}
|
||||
|
||||
- (void)layoutAnimatedLayer {
|
||||
CALayer *layer = self.indefiniteAnimatedLayer;
|
||||
|
||||
if (!layer.superlayer) {
|
||||
[self.layer addSublayer:layer];
|
||||
}
|
||||
|
||||
CGFloat widthDiff = CGRectGetWidth(self.bounds) - CGRectGetWidth(layer.bounds);
|
||||
CGFloat heightDiff = CGRectGetHeight(self.bounds) - CGRectGetHeight(layer.bounds);
|
||||
layer.position = CGPointMake(CGRectGetWidth(self.bounds) - CGRectGetWidth(layer.bounds) / 2 - widthDiff / 2, CGRectGetHeight(self.bounds) - CGRectGetHeight(layer.bounds) / 2 - heightDiff / 2);
|
||||
}
|
||||
|
||||
- (CAShapeLayer*)indefiniteAnimatedLayer {
|
||||
if(!_indefiniteAnimatedLayer) {
|
||||
CGPoint arcCenter = CGPointMake(self.radius+self.strokeThickness/2+5, self.radius+self.strokeThickness/2+5);
|
||||
UIBezierPath* smoothedPath = [UIBezierPath bezierPathWithArcCenter:arcCenter radius:self.radius startAngle:(CGFloat) (M_PI*3/2) endAngle:(CGFloat) (M_PI/2+M_PI*5) clockwise:YES];
|
||||
|
||||
_indefiniteAnimatedLayer = [CAShapeLayer layer];
|
||||
_indefiniteAnimatedLayer.contentsScale = [[UIScreen mainScreen] scale];
|
||||
_indefiniteAnimatedLayer.frame = CGRectMake(0.0f, 0.0f, arcCenter.x*2, arcCenter.y*2);
|
||||
_indefiniteAnimatedLayer.fillColor = [UIColor clearColor].CGColor;
|
||||
_indefiniteAnimatedLayer.strokeColor = self.strokeColor.CGColor;
|
||||
_indefiniteAnimatedLayer.lineWidth = self.strokeThickness;
|
||||
_indefiniteAnimatedLayer.lineCap = kCALineCapRound;
|
||||
_indefiniteAnimatedLayer.lineJoin = kCALineJoinBevel;
|
||||
_indefiniteAnimatedLayer.path = smoothedPath.CGPath;
|
||||
|
||||
CALayer *maskLayer = [CALayer layer];
|
||||
|
||||
NSBundle *imageBundle = [SVProgressHUD imageBundle];
|
||||
|
||||
maskLayer.contents = (__bridge id)[[UIImage imageNamed:@"angle-mask.png" inBundle:imageBundle compatibleWithTraitCollection:nil] CGImage];
|
||||
maskLayer.frame = _indefiniteAnimatedLayer.bounds;
|
||||
_indefiniteAnimatedLayer.mask = maskLayer;
|
||||
|
||||
NSTimeInterval animationDuration = 1;
|
||||
CAMediaTimingFunction *linearCurve = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
|
||||
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
|
||||
animation.fromValue = (id) 0;
|
||||
animation.toValue = @(M_PI*2);
|
||||
animation.duration = animationDuration;
|
||||
animation.timingFunction = linearCurve;
|
||||
animation.removedOnCompletion = NO;
|
||||
animation.repeatCount = INFINITY;
|
||||
animation.fillMode = kCAFillModeForwards;
|
||||
animation.autoreverses = NO;
|
||||
[_indefiniteAnimatedLayer.mask addAnimation:animation forKey:@"rotate"];
|
||||
|
||||
CAAnimationGroup *animationGroup = [CAAnimationGroup animation];
|
||||
animationGroup.duration = animationDuration;
|
||||
animationGroup.repeatCount = INFINITY;
|
||||
animationGroup.removedOnCompletion = NO;
|
||||
animationGroup.timingFunction = linearCurve;
|
||||
|
||||
CABasicAnimation *strokeStartAnimation = [CABasicAnimation animationWithKeyPath:@"strokeStart"];
|
||||
strokeStartAnimation.fromValue = @0.015;
|
||||
strokeStartAnimation.toValue = @0.515;
|
||||
|
||||
CABasicAnimation *strokeEndAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
|
||||
strokeEndAnimation.fromValue = @0.485;
|
||||
strokeEndAnimation.toValue = @0.985;
|
||||
|
||||
animationGroup.animations = @[strokeStartAnimation, strokeEndAnimation];
|
||||
[_indefiniteAnimatedLayer addAnimation:animationGroup forKey:@"progress"];
|
||||
|
||||
}
|
||||
return _indefiniteAnimatedLayer;
|
||||
}
|
||||
|
||||
- (void)setFrame:(CGRect)frame {
|
||||
if(!CGRectEqualToRect(frame, super.frame)) {
|
||||
[super setFrame:frame];
|
||||
|
||||
if(self.superview) {
|
||||
[self layoutAnimatedLayer];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)setRadius:(CGFloat)radius {
|
||||
if(radius != _radius) {
|
||||
_radius = radius;
|
||||
|
||||
[_indefiniteAnimatedLayer removeFromSuperlayer];
|
||||
_indefiniteAnimatedLayer = nil;
|
||||
|
||||
if(self.superview) {
|
||||
[self layoutAnimatedLayer];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setStrokeColor:(UIColor*)strokeColor {
|
||||
_strokeColor = strokeColor;
|
||||
_indefiniteAnimatedLayer.strokeColor = strokeColor.CGColor;
|
||||
}
|
||||
|
||||
- (void)setStrokeThickness:(CGFloat)strokeThickness {
|
||||
_strokeThickness = strokeThickness;
|
||||
_indefiniteAnimatedLayer.lineWidth = _strokeThickness;
|
||||
}
|
||||
|
||||
- (CGSize)sizeThatFits:(CGSize)size {
|
||||
return CGSizeMake((self.radius+self.strokeThickness/2+5)*2, (self.radius+self.strokeThickness/2+5)*2);
|
||||
}
|
||||
|
||||
@end
|
||||
17
Pods/SVProgressHUD/SVProgressHUD/SVProgressAnimatedView.h
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// SVProgressAnimatedView.h
|
||||
// SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
|
||||
//
|
||||
// Copyright (c) 2017-2023 Tobias Totzek and contributors. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface SVProgressAnimatedView : UIView
|
||||
|
||||
@property (nonatomic, assign) CGFloat radius;
|
||||
@property (nonatomic, assign) CGFloat strokeThickness;
|
||||
@property (nonatomic, strong) UIColor *strokeColor;
|
||||
@property (nonatomic, assign) CGFloat strokeEnd;
|
||||
|
||||
@end
|
||||
96
Pods/SVProgressHUD/SVProgressHUD/SVProgressAnimatedView.m
generated
Normal file
@@ -0,0 +1,96 @@
|
||||
//
|
||||
// SVProgressAnimatedView.m
|
||||
// SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
|
||||
//
|
||||
// Copyright (c) 2017-2023 Tobias Totzek and contributors. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SVProgressAnimatedView.h"
|
||||
|
||||
@interface SVProgressAnimatedView ()
|
||||
|
||||
@property (nonatomic, strong) CAShapeLayer *ringAnimatedLayer;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SVProgressAnimatedView
|
||||
|
||||
- (void)willMoveToSuperview:(UIView*)newSuperview {
|
||||
if (newSuperview) {
|
||||
[self layoutAnimatedLayer];
|
||||
} else {
|
||||
[_ringAnimatedLayer removeFromSuperlayer];
|
||||
_ringAnimatedLayer = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)layoutAnimatedLayer {
|
||||
CALayer *layer = self.ringAnimatedLayer;
|
||||
[self.layer addSublayer:layer];
|
||||
|
||||
CGFloat widthDiff = CGRectGetWidth(self.bounds) - CGRectGetWidth(layer.bounds);
|
||||
CGFloat heightDiff = CGRectGetHeight(self.bounds) - CGRectGetHeight(layer.bounds);
|
||||
layer.position = CGPointMake(CGRectGetWidth(self.bounds) - CGRectGetWidth(layer.bounds) / 2 - widthDiff / 2, CGRectGetHeight(self.bounds) - CGRectGetHeight(layer.bounds) / 2 - heightDiff / 2);
|
||||
}
|
||||
|
||||
- (CAShapeLayer*)ringAnimatedLayer {
|
||||
if(!_ringAnimatedLayer) {
|
||||
CGPoint arcCenter = CGPointMake(self.radius+self.strokeThickness/2+5, self.radius+self.strokeThickness/2+5);
|
||||
UIBezierPath* smoothedPath = [UIBezierPath bezierPathWithArcCenter:arcCenter radius:self.radius startAngle:(CGFloat)-M_PI_2 endAngle:(CGFloat) (M_PI + M_PI_2) clockwise:YES];
|
||||
|
||||
_ringAnimatedLayer = [CAShapeLayer layer];
|
||||
_ringAnimatedLayer.contentsScale = [[UIScreen mainScreen] scale];
|
||||
_ringAnimatedLayer.frame = CGRectMake(0.0f, 0.0f, arcCenter.x*2, arcCenter.y*2);
|
||||
_ringAnimatedLayer.fillColor = [UIColor clearColor].CGColor;
|
||||
_ringAnimatedLayer.strokeColor = self.strokeColor.CGColor;
|
||||
_ringAnimatedLayer.lineWidth = self.strokeThickness;
|
||||
_ringAnimatedLayer.lineCap = kCALineCapRound;
|
||||
_ringAnimatedLayer.lineJoin = kCALineJoinBevel;
|
||||
_ringAnimatedLayer.path = smoothedPath.CGPath;
|
||||
}
|
||||
return _ringAnimatedLayer;
|
||||
}
|
||||
|
||||
- (void)setFrame:(CGRect)frame {
|
||||
if(!CGRectEqualToRect(frame, super.frame)) {
|
||||
[super setFrame:frame];
|
||||
|
||||
if(self.superview) {
|
||||
[self layoutAnimatedLayer];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setRadius:(CGFloat)radius {
|
||||
if(radius != _radius) {
|
||||
_radius = radius;
|
||||
|
||||
[_ringAnimatedLayer removeFromSuperlayer];
|
||||
_ringAnimatedLayer = nil;
|
||||
|
||||
if(self.superview) {
|
||||
[self layoutAnimatedLayer];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setStrokeColor:(UIColor*)strokeColor {
|
||||
_strokeColor = strokeColor;
|
||||
_ringAnimatedLayer.strokeColor = strokeColor.CGColor;
|
||||
}
|
||||
|
||||
- (void)setStrokeThickness:(CGFloat)strokeThickness {
|
||||
_strokeThickness = strokeThickness;
|
||||
_ringAnimatedLayer.lineWidth = _strokeThickness;
|
||||
}
|
||||
|
||||
- (void)setStrokeEnd:(CGFloat)strokeEnd {
|
||||
_strokeEnd = strokeEnd;
|
||||
_ringAnimatedLayer.strokeEnd = _strokeEnd;
|
||||
}
|
||||
|
||||
- (CGSize)sizeThatFits:(CGSize)size {
|
||||
return CGSizeMake((self.radius+self.strokeThickness/2+5)*2, (self.radius+self.strokeThickness/2+5)*2);
|
||||
}
|
||||
|
||||
@end
|
||||
BIN
Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/angle-mask.png
generated
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/angle-mask@2x.png
generated
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/angle-mask@3x.png
generated
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
BIN
Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error.png
generated
Normal file
|
After Width: | Height: | Size: 184 B |
BIN
Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error@2x.png
generated
Normal file
|
After Width: | Height: | Size: 306 B |
BIN
Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error@3x.png
generated
Normal file
|
After Width: | Height: | Size: 398 B |
BIN
Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/info.png
generated
Normal file
|
After Width: | Height: | Size: 365 B |
BIN
Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/info@2x.png
generated
Normal file
|
After Width: | Height: | Size: 816 B |
BIN
Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/info@3x.png
generated
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success.png
generated
Normal file
|
After Width: | Height: | Size: 262 B |
BIN
Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success@2x.png
generated
Normal file
|
After Width: | Height: | Size: 462 B |
BIN
Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success@3x.png
generated
Normal file
|
After Width: | Height: | Size: 714 B |
392
Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.h
generated
Normal file
@@ -0,0 +1,392 @@
|
||||
//
|
||||
// SVProgressHUD.h
|
||||
// SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
|
||||
//
|
||||
// Copyright (c) 2011-2023 Sam Vermette and contributors. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <AvailabilityMacros.h>
|
||||
|
||||
extern NSString * _Nonnull const SVProgressHUDDidReceiveTouchEventNotification;
|
||||
extern NSString * _Nonnull const SVProgressHUDDidTouchDownInsideNotification;
|
||||
extern NSString * _Nonnull const SVProgressHUDWillDisappearNotification;
|
||||
extern NSString * _Nonnull const SVProgressHUDDidDisappearNotification;
|
||||
extern NSString * _Nonnull const SVProgressHUDWillAppearNotification;
|
||||
extern NSString * _Nonnull const SVProgressHUDDidAppearNotification;
|
||||
|
||||
extern NSString * _Nonnull const SVProgressHUDStatusUserInfoKey;
|
||||
|
||||
/// Represents the appearance style of the HUD.
|
||||
typedef NS_ENUM(NSInteger, SVProgressHUDStyle) {
|
||||
/// White HUD with black text. HUD background will be blurred.
|
||||
SVProgressHUDStyleLight NS_SWIFT_NAME(light),
|
||||
|
||||
/// Black HUD with white text. HUD background will be blurred.
|
||||
SVProgressHUDStyleDark NS_SWIFT_NAME(dark),
|
||||
|
||||
/// Uses the fore- and background color properties.
|
||||
SVProgressHUDStyleCustom NS_SWIFT_NAME(custom),
|
||||
|
||||
/// Automatically switch between light or dark mode appearance.
|
||||
SVProgressHUDStyleAutomatic NS_SWIFT_NAME(automatic)
|
||||
};
|
||||
|
||||
/// Represents the type of mask to be applied when the HUD is displayed.
|
||||
typedef NS_ENUM(NSUInteger, SVProgressHUDMaskType) {
|
||||
/// Allow user interactions while HUD is displayed.
|
||||
SVProgressHUDMaskTypeNone NS_SWIFT_NAME(none) = 1,
|
||||
|
||||
/// Don't allow user interactions with background objects.
|
||||
SVProgressHUDMaskTypeClear NS_SWIFT_NAME(clear),
|
||||
|
||||
/// Don't allow user interactions and dim the UI behind the HUD (as in iOS 7+).
|
||||
SVProgressHUDMaskTypeBlack NS_SWIFT_NAME(black),
|
||||
|
||||
/// Don't allow user interactions and dim the UI with an UIAlertView-like background gradient (as in iOS 6).
|
||||
SVProgressHUDMaskTypeGradient NS_SWIFT_NAME(gradient),
|
||||
|
||||
/// Don't allow user interactions and dim the UI behind the HUD with a custom color.
|
||||
SVProgressHUDMaskTypeCustom NS_SWIFT_NAME(custom)
|
||||
};
|
||||
|
||||
/// Represents the animation type of the HUD when it's shown or hidden.
|
||||
typedef NS_ENUM(NSUInteger, SVProgressHUDAnimationType) {
|
||||
/// Custom flat animation (indefinite animated ring).
|
||||
SVProgressHUDAnimationTypeFlat NS_SWIFT_NAME(flat),
|
||||
|
||||
/// iOS native UIActivityIndicatorView.
|
||||
SVProgressHUDAnimationTypeNative NS_SWIFT_NAME(native)
|
||||
};
|
||||
|
||||
typedef void (^SVProgressHUDShowCompletion)(void);
|
||||
typedef void (^SVProgressHUDDismissCompletion)(void);
|
||||
|
||||
@interface SVProgressHUD : UIView
|
||||
|
||||
#pragma mark - Customization
|
||||
|
||||
/// Represents the default style for the HUD.
|
||||
/// @discussion Default: SVProgressHUDStyleAutomatic.
|
||||
@property (assign, nonatomic) SVProgressHUDStyle defaultStyle UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// Represents the type of mask applied when the HUD is displayed.
|
||||
/// @discussion Default: SVProgressHUDMaskTypeNone.
|
||||
@property (assign, nonatomic) SVProgressHUDMaskType defaultMaskType UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// Defines the animation type used when the HUD is displayed.
|
||||
/// @discussion Default: SVProgressHUDAnimationTypeFlat.
|
||||
@property (assign, nonatomic) SVProgressHUDAnimationType defaultAnimationType UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// The container view used for displaying the HUD. If nil, the default window level is used.
|
||||
@property (strong, nonatomic, nullable) UIView *containerView;
|
||||
|
||||
/// The minimum size for the HUD. Useful for maintaining a consistent size when the message might cause resizing.
|
||||
/// @discussion Default: CGSizeZero.
|
||||
@property (assign, nonatomic) CGSize minimumSize UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// Thickness of the ring shown in the HUD.
|
||||
/// @discussion Default: 2 pt.
|
||||
@property (assign, nonatomic) CGFloat ringThickness UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// Radius of the ring shown in the HUD when there's associated text.
|
||||
/// @discussion Default: 18 pt.
|
||||
@property (assign, nonatomic) CGFloat ringRadius UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// Radius of the ring shown in the HUD when there's no associated text.
|
||||
/// @discussion Default: 24 pt.
|
||||
@property (assign, nonatomic) CGFloat ringNoTextRadius UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// Corner radius of the HUD view.
|
||||
/// @discussion Default: 14 pt.
|
||||
@property (assign, nonatomic) CGFloat cornerRadius UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// Font used for text within the HUD.
|
||||
/// @discussion Default: [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline].
|
||||
@property (strong, nonatomic, nonnull) UIFont *font UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// Background color of the HUD.
|
||||
/// @discussion Default: [UIColor whiteColor].
|
||||
@property (strong, nonatomic, nonnull) UIColor *backgroundColor UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// Foreground color used for content in the HUD.
|
||||
/// @discussion Default: [UIColor blackColor].
|
||||
@property (strong, nonatomic, nonnull) UIColor *foregroundColor UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// Color for any foreground images in the HUD.
|
||||
/// @discussion Default: same as foregroundColor.
|
||||
@property (strong, nonatomic, nullable) UIColor *foregroundImageColor UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// Color for the background layer behind the HUD.
|
||||
/// @discussion Default: [UIColor colorWithWhite:0 alpha:0.4].
|
||||
@property (strong, nonatomic, nonnull) UIColor *backgroundLayerColor UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// Size of any images displayed within the HUD.
|
||||
/// @discussion Default: 28x28 pt.
|
||||
@property (assign, nonatomic) CGSize imageViewSize UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// Indicates whether images within the HUD should be tinted.
|
||||
/// @discussion Default: YES.
|
||||
@property (assign, nonatomic) BOOL shouldTintImages UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// The image displayed when showing informational messages.
|
||||
/// @discussion Default: info.circle from SF Symbols (iOS 13+) or the bundled info image provided by Freepik.
|
||||
@property (strong, nonatomic, nonnull) UIImage *infoImage UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// The image displayed when showing success messages.
|
||||
/// @discussion Default: checkmark from SF Symbols (iOS 13+) or the bundled success image provided by Freepik.
|
||||
@property (strong, nonatomic, nonnull) UIImage *successImage UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// The image displayed when showing error messages.
|
||||
/// @discussion Default: xmark from SF Symbols (iOS 13+) or the bundled error image provided by Freepik.
|
||||
@property (strong, nonatomic, nonnull) UIImage *errorImage UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// A specific view for extensions. This property is only used if #define SV_APP_EXTENSIONS is set.
|
||||
/// @discussion Default: nil.
|
||||
@property (strong, nonatomic, nonnull) UIView *viewForExtension UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// The interval in seconds to wait before displaying the HUD. If the HUD is displayed before this time elapses, this timer is reset.
|
||||
/// @discussion Default: 0 seconds.
|
||||
@property (assign, nonatomic) NSTimeInterval graceTimeInterval;
|
||||
|
||||
/// The minimum amount of time in seconds the HUD will display.
|
||||
/// @discussion Default: 5.0 seconds.
|
||||
@property (assign, nonatomic) NSTimeInterval minimumDismissTimeInterval;
|
||||
|
||||
/// The maximum amount of time in seconds the HUD will display.
|
||||
/// @discussion Default: CGFLOAT_MAX.
|
||||
@property (assign, nonatomic) NSTimeInterval maximumDismissTimeInterval;
|
||||
|
||||
/// Offset from the center position, can be used to adjust the HUD position.
|
||||
/// @discussion Default: 0, 0.
|
||||
@property (assign, nonatomic) UIOffset offsetFromCenter UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// Duration of the fade-in animation when showing the HUD.
|
||||
/// @discussion Default: 0.15.
|
||||
@property (assign, nonatomic) NSTimeInterval fadeInAnimationDuration UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// Duration of the fade-out animation when hiding the HUD.
|
||||
/// @discussion Default: 0.15.
|
||||
@property (assign, nonatomic) NSTimeInterval fadeOutAnimationDuration UI_APPEARANCE_SELECTOR;
|
||||
|
||||
/// The maximum window level on which the HUD can be displayed.
|
||||
/// @discussion Default: UIWindowLevelNormal.
|
||||
@property (assign, nonatomic) UIWindowLevel maxSupportedWindowLevel;
|
||||
|
||||
/// Indicates if haptic feedback should be used.
|
||||
/// @discussion Default: NO.
|
||||
@property (assign, nonatomic) BOOL hapticsEnabled;
|
||||
|
||||
/// Indicates if motion effects should be applied to the HUD.
|
||||
/// @discussion Default: YES.
|
||||
@property (assign, nonatomic) BOOL motionEffectEnabled;
|
||||
|
||||
@property (class, strong, nonatomic, readonly, nonnull) NSBundle *imageBundle;
|
||||
|
||||
/// Sets the default style for the HUD.
|
||||
/// @param style The desired style for the HUD.
|
||||
+ (void)setDefaultStyle:(SVProgressHUDStyle)style;
|
||||
|
||||
/// Sets the default mask type for the HUD.
|
||||
/// @param maskType The mask type to apply.
|
||||
+ (void)setDefaultMaskType:(SVProgressHUDMaskType)maskType;
|
||||
|
||||
/// Sets the default animation type for the HUD.
|
||||
/// @param type The desired animation type.
|
||||
+ (void)setDefaultAnimationType:(SVProgressHUDAnimationType)type;
|
||||
|
||||
/// Sets the container view for the HUD.
|
||||
/// @param containerView The view to contain the HUD.
|
||||
+ (void)setContainerView:(nullable UIView*)containerView;
|
||||
|
||||
/// Sets the minimum size for the HUD.
|
||||
/// @param minimumSize The minimum size for the HUD.
|
||||
+ (void)setMinimumSize:(CGSize)minimumSize;
|
||||
|
||||
/// Sets the ring thickness for the HUD.
|
||||
/// @param ringThickness Thickness of the ring.
|
||||
+ (void)setRingThickness:(CGFloat)ringThickness;
|
||||
|
||||
/// Sets the ring radius for the HUD.
|
||||
/// @param radius Radius of the ring.
|
||||
+ (void)setRingRadius:(CGFloat)radius;
|
||||
|
||||
/// Sets the no text ring radius for the HUD.
|
||||
/// @param radius Radius of the ring when no text is displayed.
|
||||
+ (void)setRingNoTextRadius:(CGFloat)radius;
|
||||
|
||||
/// Sets the corner radius for the HUD.
|
||||
/// @param cornerRadius Desired corner radius.
|
||||
+ (void)setCornerRadius:(CGFloat)cornerRadius;
|
||||
|
||||
/// Sets the border color for the HUD.
|
||||
/// @param color Desired border color.
|
||||
+ (void)setBorderColor:(nonnull UIColor*)color;
|
||||
|
||||
/// Sets the border width for the HUD.
|
||||
/// @param width Desired border width.
|
||||
+ (void)setBorderWidth:(CGFloat)width;
|
||||
|
||||
/// Sets the font for the HUD's text.
|
||||
/// @param font Desired font for the text.
|
||||
+ (void)setFont:(nonnull UIFont*)font;
|
||||
|
||||
/// Sets the foreground color for the HUD.
|
||||
/// @param color Desired foreground color.
|
||||
/// @discussion These implicitly set the HUD's style to `SVProgressHUDStyleCustom`.
|
||||
+ (void)setForegroundColor:(nonnull UIColor*)color;
|
||||
|
||||
/// Sets the foreground image color for the HUD.
|
||||
/// @param color Desired color for the image.
|
||||
/// @discussion These implicitly set the HUD's style to `SVProgressHUDStyleCustom`.
|
||||
+ (void)setForegroundImageColor:(nullable UIColor*)color;
|
||||
|
||||
/// Sets the background color for the HUD.
|
||||
/// @param color Desired background color.
|
||||
/// @discussion These implicitly set the HUD's style to `SVProgressHUDStyleCustom`.
|
||||
+ (void)setBackgroundColor:(nonnull UIColor*)color;
|
||||
|
||||
/// Sets a custom blur effect for the HUD view.
|
||||
/// @param blurEffect Desired blur effect.
|
||||
/// @discussion These implicitly set the HUD's style to `SVProgressHUDStyleCustom`.
|
||||
+ (void)setHudViewCustomBlurEffect:(nullable UIBlurEffect*)blurEffect;
|
||||
|
||||
/// Sets the background layer color for the HUD.
|
||||
/// @param color Desired color for the background layer.
|
||||
+ (void)setBackgroundLayerColor:(nonnull UIColor*)color;
|
||||
|
||||
/// Sets the size for the HUD's image view.
|
||||
/// @param size Desired size for the image view.
|
||||
+ (void)setImageViewSize:(CGSize)size;
|
||||
|
||||
/// Determines if images should be tinted in the HUD.
|
||||
/// @param shouldTintImages Whether images should be tinted.
|
||||
+ (void)setShouldTintImages:(BOOL)shouldTintImages;
|
||||
|
||||
/// Sets the info image for the HUD.
|
||||
/// @param image The desired info image.
|
||||
+ (void)setInfoImage:(nonnull UIImage*)image;
|
||||
|
||||
/// Sets the success image for the HUD.
|
||||
/// @param image The desired success image.
|
||||
+ (void)setSuccessImage:(nonnull UIImage*)image;
|
||||
|
||||
/// Sets the error image for the HUD.
|
||||
/// @param image The desired error image.
|
||||
+ (void)setErrorImage:(nonnull UIImage*)image;
|
||||
|
||||
/// Sets the view for extensions.
|
||||
/// @param view The desired view for extensions.
|
||||
+ (void)setViewForExtension:(nonnull UIView*)view;
|
||||
|
||||
/// Sets the grace time interval for the HUD.
|
||||
/// @param interval Desired grace time interval.
|
||||
+ (void)setGraceTimeInterval:(NSTimeInterval)interval;
|
||||
|
||||
/// Sets the minimum dismiss time interval.
|
||||
/// @param interval The minimum time interval, in seconds, that the HUD should be displayed.
|
||||
+ (void)setMinimumDismissTimeInterval:(NSTimeInterval)interval;
|
||||
|
||||
/// Sets the maximum dismiss time interval.
|
||||
/// @param interval The maximum time interval, in seconds, that the HUD should be displayed.
|
||||
+ (void)setMaximumDismissTimeInterval:(NSTimeInterval)interval;
|
||||
|
||||
/// Sets the fade-in animation duration.
|
||||
/// @param duration The duration, in seconds, for the fade-in animation.
|
||||
+ (void)setFadeInAnimationDuration:(NSTimeInterval)duration;
|
||||
|
||||
/// Sets the fade-out animation duration.
|
||||
/// @param duration The duration, in seconds, for the fade-out animation.
|
||||
+ (void)setFadeOutAnimationDuration:(NSTimeInterval)duration;
|
||||
|
||||
/// Sets the max supported window level.
|
||||
/// @param windowLevel The UIWindowLevel to which the HUD should be displayed.
|
||||
+ (void)setMaxSupportedWindowLevel:(UIWindowLevel)windowLevel;
|
||||
|
||||
/// Determines if haptics are enabled.
|
||||
/// @param hapticsEnabled A boolean that determines if haptic feedback is enabled.
|
||||
+ (void)setHapticsEnabled:(BOOL)hapticsEnabled;
|
||||
|
||||
/// Determines if motion effect is enabled.
|
||||
/// @param motionEffectEnabled A boolean that determines if motion effects are enabled.
|
||||
+ (void)setMotionEffectEnabled:(BOOL)motionEffectEnabled;
|
||||
|
||||
|
||||
#pragma mark - Show Methods
|
||||
|
||||
/// Shows the HUD without any additional status message.
|
||||
+ (void)show;
|
||||
|
||||
/// Shows the HUD with a provided status message.
|
||||
/// @param status The message to be displayed alongside the HUD.
|
||||
+ (void)showWithStatus:(nullable NSString*)status;
|
||||
|
||||
/// Display methods to show progress on the HUD.
|
||||
|
||||
/// Shows the HUD with a progress indicator.
|
||||
/// @param progress A float value between 0.0 and 1.0 indicating the progress.
|
||||
+ (void)showProgress:(float)progress;
|
||||
|
||||
/// Shows the HUD with a progress indicator and a provided status message.
|
||||
/// @param progress A float value between 0.0 and 1.0 indicating the progress.
|
||||
/// @param status The message to be displayed alongside the progress indicator.
|
||||
+ (void)showProgress:(float)progress status:(nullable NSString*)status;
|
||||
|
||||
/// Updates the current status of the loading HUD.
|
||||
/// @param status The new status message to update the HUD with.
|
||||
+ (void)setStatus:(nullable NSString*)status;
|
||||
|
||||
/// Shows an info status with the provided message.
|
||||
/// @param status The info message to be displayed.
|
||||
+ (void)showInfoWithStatus:(nullable NSString*)status;
|
||||
|
||||
/// Shows a success status with the provided message.
|
||||
/// @param status The success message to be displayed.
|
||||
+ (void)showSuccessWithStatus:(nullable NSString*)status;
|
||||
|
||||
/// Shows an error status with the provided message.
|
||||
/// @param status The error message to be displayed.
|
||||
+ (void)showErrorWithStatus:(nullable NSString*)status;
|
||||
|
||||
/// Shows a custom image with the provided status message.
|
||||
/// @param image The custom image to be displayed.
|
||||
/// @param status The message to accompany the custom image.
|
||||
+ (void)showImage:(nonnull UIImage*)image status:(nullable NSString*)status;
|
||||
|
||||
/// Sets the offset from the center for the HUD.
|
||||
/// @param offset The UIOffset value indicating how much the HUD should be offset from its center position.
|
||||
+ (void)setOffsetFromCenter:(UIOffset)offset;
|
||||
|
||||
/// Resets the offset to center the HUD.
|
||||
+ (void)resetOffsetFromCenter;
|
||||
|
||||
/// Decreases the activity count, dismissing the HUD if count reaches 0.
|
||||
+ (void)popActivity;
|
||||
|
||||
/// Dismisses the HUD immediately.
|
||||
+ (void)dismiss;
|
||||
|
||||
/// Dismisses the HUD and triggers a completion block.
|
||||
/// @param completion A block that gets executed after the HUD is dismissed.
|
||||
+ (void)dismissWithCompletion:(nullable SVProgressHUDDismissCompletion)completion;
|
||||
|
||||
/// Dismisses the HUD after a specified delay.
|
||||
/// @param delay The time in seconds after which the HUD should be dismissed.
|
||||
+ (void)dismissWithDelay:(NSTimeInterval)delay;
|
||||
|
||||
/// Dismisses the HUD after a specified delay and triggers a completion block.
|
||||
/// @param delay The time in seconds after which the HUD should be dismissed.
|
||||
/// @param completion A block that gets executed after the HUD is dismissed.
|
||||
+ (void)dismissWithDelay:(NSTimeInterval)delay completion:(nullable SVProgressHUDDismissCompletion)completion;
|
||||
|
||||
/// Checks if the HUD is currently visible.
|
||||
/// @return A boolean value indicating whether the HUD is visible.
|
||||
+ (BOOL)isVisible;
|
||||
|
||||
/// Calculates the display duration based on a given string's length.
|
||||
/// @param string The string whose length determines the display duration.
|
||||
/// @return A time interval representing the display duration.
|
||||
+ (NSTimeInterval)displayDurationForString:(nullable NSString*)string;
|
||||
|
||||
@end
|
||||
|
||||
1524
Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.m
generated
Normal file
14
Pods/SVProgressHUD/SVProgressHUD/SVRadialGradientLayer.h
generated
Normal file
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// SVRadialGradientLayer.h
|
||||
// SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
|
||||
//
|
||||
// Copyright (c) 2014-2023 Tobias Totzek and contributors. All rights reserved.
|
||||
//
|
||||
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
@interface SVRadialGradientLayer : CALayer
|
||||
|
||||
@property (nonatomic) CGPoint gradientCenter;
|
||||
|
||||
@end
|
||||
25
Pods/SVProgressHUD/SVProgressHUD/SVRadialGradientLayer.m
generated
Normal file
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// SVRadialGradientLayer.m
|
||||
// SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
|
||||
//
|
||||
// Copyright (c) 2014-2023 Tobias Totzek and contributors. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SVRadialGradientLayer.h"
|
||||
|
||||
@implementation SVRadialGradientLayer
|
||||
|
||||
- (void)drawInContext:(CGContextRef)context {
|
||||
size_t locationsCount = 2;
|
||||
CGFloat locations[2] = {0.0f, 1.0f};
|
||||
CGFloat colors[8] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.75f};
|
||||
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
|
||||
CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, colors, locations, locationsCount);
|
||||
CGColorSpaceRelease(colorSpace);
|
||||
|
||||
float radius = MIN(self.bounds.size.width , self.bounds.size.height);
|
||||
CGContextDrawRadialGradient (context, gradient, self.gradientCenter, 0, self.gradientCenter, radius, kCGGradientDrawsAfterEndLocation);
|
||||
CGGradientRelease(gradient);
|
||||
}
|
||||
|
||||
@end
|
||||