Skip to content

Commit

Permalink
Make enableUIFeedback available from iOS 10 (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
iwb-kevin-hirsch committed Oct 29, 2018
1 parent c1f9ca4 commit 519ac3f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
2 changes: 2 additions & 0 deletions KVNProgress.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "iPhone Developer";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "KVNProgress/KVNProgress-Prefix.pch";
Expand All @@ -595,6 +596,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "iPhone Developer";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "KVNProgress/KVNProgress-Prefix.pch";
Expand Down
8 changes: 5 additions & 3 deletions KVNProgress/Classes/KVNProgress.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ @interface KVNProgress ()
@property (atomic) NSBlockOperation *animateAppearanceOperation;
@property (nonatomic, strong) UIWindow *progressWindow;
@property (nonatomic, strong) UIWindow *originalKeyWindow;
@property (nonatomic, strong) UINotificationFeedbackGenerator *feedbackGenerator;
@property (nonatomic, strong) UINotificationFeedbackGenerator *feedbackGenerator API_AVAILABLE(ios(10.0));

@end

Expand Down Expand Up @@ -457,7 +457,9 @@ - (void)showProgress:(CGFloat)progress
});
}

[self sendUIFeedbackIfNeededFor:self.style];
if (@available(iOS 10.0, *)) {
[self sendUIFeedbackIfNeededFor:self.style];
}
}

- (UIView *)accessibilityView
Expand All @@ -471,7 +473,7 @@ - (UIView *)accessibilityView
}
}

- (void)sendUIFeedbackIfNeededFor:(KVNProgressStyle)style
- (void)sendUIFeedbackIfNeededFor:(KVNProgressStyle)style API_AVAILABLE(ios(10.0))
{
if (!configuration.isUIFeedbackEnabled) {

This comment has been minimized.

Copy link
@AnthonyUccello

AnthonyUccello Oct 30, 2018

After doing a pod update on our project (which is Xcode 10 and Swift 4.2) this line is now throwing an error:

screen shot 2018-10-30 at 11 59 56 am

return;
Expand Down
10 changes: 8 additions & 2 deletions KVNProgress/Classes/KVNProgressConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ - (id)init

_tapBlock = nil;
_allowUserInteraction = NO;
_enableUIFeedback = NO;

if (@available(iOS 10, *)) {
_enableUIFeedback = NO;
}
}

return self;
Expand Down Expand Up @@ -79,7 +82,10 @@ - (id)copyWithZone:(NSZone *)zone

copy.tapBlock = self.tapBlock;
copy.allowUserInteraction = self.allowUserInteraction;
copy.enableUIFeedback = self.enableUIFeedback;

if (@available(iOS 10, *)) {
copy.enableUIFeedback = self.enableUIFeedback;
}

return copy;
}
Expand Down
5 changes: 4 additions & 1 deletion KVNProgress/Demo/KVNViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ - (KVNProgressConfiguration *)customKVNProgressUIConfiguration
configuration.lineWidth = 1.0f;
configuration.showStop = YES;
configuration.stopRelativeHeight = 0.3f;
configuration.enableUIFeedback = YES;

if (@available(iOS 10, *)) {
configuration.enableUIFeedback = YES;
}

configuration.tapBlock = ^(KVNProgress *progressView) {
[KVNProgress dismiss];
Expand Down

0 comments on commit 519ac3f

Please sign in to comment.