Skip to content

Commit

Permalink
1.2.3
Browse files Browse the repository at this point in the history
• Removed asserts.
• Some fixes for Swift.
• Removed JGProgressStyleNone (See #18 to know why).
• Made base SDK >= iOS 8 obligatory.
  • Loading branch information
JonasGessner committed Jan 7, 2015
1 parent 39a16d5 commit 4f007cd
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 71 deletions.
4 changes: 2 additions & 2 deletions JGProgressHUD.podspec
@@ -1,14 +1,14 @@
Pod::Spec.new do |s|

s.name = "JGProgressHUD"
s.version = "1.2.2"
s.version = "1.2.3"
s.summary = "Powerful and modern progress HUD for iOS."
s.homepage = "https://github.com/JonasGessner/JGProgressHUD"
s.license = { :type => "MIT", :file => "LICENSE.txt" }
s.author = "Jonas Gessner"
s.social_media_url = "http://twitter.com/JonasGessner"
s.platform = :ios, "5.0"
s.source = { :git => "https://github.com/JonasGessner/JGProgressHUD.git", :tag => "v1.2.2" }
s.source = { :git => "https://github.com/JonasGessner/JGProgressHUD.git", :tag => "v1.2.3" }
s.source_files = "JGProgressHUD/JGProgressHUD/*.{h,m}"
s.resources = "JGProgressHUD/JGProgressHUD/JGProgressHUD Resources.bundle"
s.frameworks = "Foundation", "UIKit", "QuartzCore"
Expand Down
20 changes: 17 additions & 3 deletions JGProgressHUD/JGProgressHUD/JGProgressHUD.h
Expand Up @@ -10,39 +10,53 @@
#import <UIKit/UIKit.h>

#import "JGProgressHUDIndicatorView.h"
@class JGProgressHUDAnimation;
#import "JGProgressHUDAnimation.h"

/**
Positions of the HUD.
*/
typedef NS_ENUM(NSUInteger, JGProgressHUDPosition) {
/** Center position. */
JGProgressHUDPositionCenter = 0,
/** Top left position. */
JGProgressHUDPositionTopLeft,
/** Top center position. */
JGProgressHUDPositionTopCenter,
/** Top right position. */
JGProgressHUDPositionTopRight,
/** Center left position. */
JGProgressHUDPositionCenterLeft,
/** Center right position. */
JGProgressHUDPositionCenterRight,
/** Bottom left position. */
JGProgressHUDPositionBottomLeft,
/** Bottom center position. */
JGProgressHUDPositionBottomCenter,
/** Bottom right position. */
JGProgressHUDPositionBottomRight
};

/**
Appearance styles of the HUD.
*/
typedef NS_ENUM(NSUInteger, JGProgressHUDStyle) {
/** Extra light HUD with dark elements. */
JGProgressHUDStyleExtraLight = 0,
/** Light HUD with dark elemets. */

This comment has been minimized.

Copy link
@Bo98

Bo98 Feb 8, 2015

Typo here.

JGProgressHUDStyleLight,
JGProgressHUDStyleDark,
JGProgressHUDStyleNone
/** Dark HUD with light elements. */
JGProgressHUDStyleDark
};

/**
Interaction types.
*/
typedef NS_ENUM(NSUInteger, JGProgressHUDInteractionType) {
/** Block all touches. No interaction behin the HUD is possible. */

This comment has been minimized.

Copy link
@Bo98

Bo98 Feb 8, 2015

Typo here too.

JGProgressHUDInteractionTypeBlockAllTouches = 0,
/** Block touches on the HUD view. */
JGProgressHUDInteractionTypeBlockTouchesOnHUDView,
/** Block no touches. */
JGProgressHUDInteractionTypeBlockNoTouches
};

Expand Down
127 changes: 64 additions & 63 deletions JGProgressHUD/JGProgressHUD/JGProgressHUD.m
Expand Up @@ -15,36 +15,25 @@
#error "JGProgressHUD requires ARC!"
#endif

#ifndef __IPHONE_8_0
#define __IPHONE_8_0 80000
#ifndef iPad
#define iPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#endif

#define kBaseSDKiOS8 (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_8_0)

#if kBaseSDKiOS8
#define iOS8ex(available, unavailable) \
if (iOS8) { \
available \
} \
else { \
unavailable \
}
#else
#define iOS8ex(available, unavailable) \
unavailable
#ifndef NSFoundationVersionNumber_iOS_7_0
#define NSFoundationVersionNumber_iOS_7_0 1047.20
#endif

#ifndef iPad
#define iPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#ifndef NSFoundationVersionNumber_iOS_8_0
#define NSFoundationVersionNumber_iOS_8_0 1134.10
#endif

#ifndef kCFCoreFoundationVersionNumber_iOS_7_0
#define kCFCoreFoundationVersionNumber_iOS_7_0 838.00
#ifndef iOS7
#define iOS7 (NSFoundationVersionNumber >= NSFoundationVersionNumber_iOS_7_0)
#endif

#define iOS7 (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_0)

#define iOS8 ([UIVisualEffectView class] != Nil)
#ifndef iOS8
#define iOS8 (NSFoundationVersionNumber >= NSFoundationVersionNumber_iOS_8_0)
#endif

@interface JGProgressHUD () {
BOOL _transitioning;
Expand Down Expand Up @@ -326,11 +315,11 @@ - (CGRect)fullFrameInView:(UIView *)view {

- (void)applyCornerRadius {
self.HUDView.layer.cornerRadius = self.cornerRadius;
iOS8ex(
for (UIView *sub in self.HUDView.subviews) {
sub.layer.cornerRadius = self.cornerRadius;
}
,);
if (iOS8) {
for (UIView *sub in self.HUDView.subviews) {
sub.layer.cornerRadius = self.cornerRadius;
}
};
}

#pragma mark - Showing
Expand Down Expand Up @@ -381,8 +370,15 @@ - (void)showInRect:(CGRect)rect inView:(UIView *)view {
}

- (void)showInRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated {
NSAssert(!_transitioning, @"HUD is currently transitioning");
NSAssert(!self.targetView, @"HUD is already visible");
if (_transitioning) {
return;
}
else if (self.targetView != nil) {
#if DEBUG
NSLog(@"[Warning] The HUD is already visible! Ignoring.");
#endif
return;
}

_targetView = view;

Expand Down Expand Up @@ -435,7 +431,9 @@ - (void)dismissAnimated:(BOOL)animated {
return;
}

NSAssert(self.targetView, @"HUD is not visible");
if (self.targetView == nil) {
return;
}

_transitioning = YES;

Expand Down Expand Up @@ -529,38 +527,36 @@ - (BOOL)isVisible {

- (UIView *)HUDView {
if (!_HUDView) {
iOS8ex(
UIBlurEffectStyle effect;

if (self.style == JGProgressHUDStyleDark) {
effect = UIBlurEffectStyleDark;
}
else if (self.style == JGProgressHUDStyleLight) {
effect = UIBlurEffectStyleLight;
}
else {
effect = UIBlurEffectStyleExtraLight;
}

UIBlurEffect *blurEffect = self.style != JGProgressHUDStyleNone ? [UIBlurEffect effectWithStyle:effect] : nil;

_HUDView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
,
_HUDView = [[UIView alloc] init];

if (self.style == JGProgressHUDStyleDark) {
_HUDView.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.8f];
}
else if (self.style == JGProgressHUDStyleLight) {
_HUDView.backgroundColor = [UIColor colorWithWhite:1.0f alpha:0.75f];
}
else if (self.style == JGProgressHUDStyleNone) {
_HUDView.backgroundColor = [UIColor clearColor];
}
else {
_HUDView.backgroundColor = [UIColor colorWithWhite:1.0f alpha:0.95f];
}
);
if (iOS8) {
UIBlurEffectStyle effect = 0;

if (self.style == JGProgressHUDStyleDark) {
effect = UIBlurEffectStyleDark;
}
else if (self.style == JGProgressHUDStyleLight) {
effect = UIBlurEffectStyleLight;
}
else {
effect = UIBlurEffectStyleExtraLight;
}

UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:effect];

_HUDView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
}
else {
_HUDView = [[UIView alloc] init];

if (self.style == JGProgressHUDStyleDark) {
_HUDView.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.8f];
}
else if (self.style == JGProgressHUDStyleLight) {
_HUDView.backgroundColor = [UIColor colorWithWhite:1.0f alpha:0.75f];
}
else {
_HUDView.backgroundColor = [UIColor colorWithWhite:1.0f alpha:0.95f];
}
}

if (iOS7) {
UIInterpolatingMotionEffect *x = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.x" type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis];
Expand Down Expand Up @@ -593,7 +589,12 @@ - (UIView *)HUDView {
}

- (UIView *)contentView {
iOS8ex(return ((UIVisualEffectView *)self.HUDView).contentView;, return self.HUDView;);
if (iOS8) {
return ((UIVisualEffectView *)self.HUDView).contentView;
}
else {
return self.HUDView;
}
}

- (UILabel *)textLabel {
Expand Down
5 changes: 4 additions & 1 deletion JGProgressHUD/JGProgressHUD/JGProgressHUDAnimation.h
Expand Up @@ -6,7 +6,10 @@
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//

#import "JGProgressHUD.h"
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@class JGProgressHUD;

/**
You may subclass this class to create a custom progress indicator view.
Expand Down
1 change: 1 addition & 0 deletions JGProgressHUD/JGProgressHUD/JGProgressHUDAnimation.m
Expand Up @@ -7,6 +7,7 @@
//

#import "JGProgressHUDAnimation.h"
#import "JGProgressHUD.h"

@interface JGProgressHUD (Private)

Expand Down
1 change: 1 addition & 0 deletions JGProgressHUD/JGProgressHUD/JGProgressHUDFadeAnimation.m
Expand Up @@ -7,6 +7,7 @@
//

#import "JGProgressHUDFadeAnimation.h"
#import "JGProgressHUD.h"

@implementation JGProgressHUDFadeAnimation

Expand Down
Expand Up @@ -7,6 +7,7 @@
//

#import "JGProgressHUDFadeZoomAnimation.h"
#import "JGProgressHUD.h"

@implementation JGProgressHUDFadeZoomAnimation

Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -21,7 +21,7 @@ Overview
<br>
The <a href="JGProgressHUD%20Tests">JGProgressHUD Tests</a> example project contains all kinds of different uses of JGProgressHUD. Check out the code and see how much JGProgressHUD can do!
<br>
#####Current Version: 1.2.2
#####Current Version: 1.2.3

##Customization:

Expand Down Expand Up @@ -52,7 +52,7 @@ To dim the content behind the HUD set your dim color as `backgroundColor` of you
Requirements
=================

• Base SDK of iOS 7 or higher.<br>
• Base SDK of iOS 8 or higher.<br>
• Deployment target of iOS 5 or higher.<br>
• ARC.

Expand Down

0 comments on commit 4f007cd

Please sign in to comment.