diff --git a/ExampleProject/KINWebBrowserExample.xcodeproj/project.pbxproj b/ExampleProject/KINWebBrowserExample.xcodeproj/project.pbxproj
index 1d2ff60..6657463 100644
--- a/ExampleProject/KINWebBrowserExample.xcodeproj/project.pbxproj
+++ b/ExampleProject/KINWebBrowserExample.xcodeproj/project.pbxproj
@@ -230,6 +230,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
+ English,
en,
);
mainGroup = 3BBECF1C18A1E58D00A2499D;
@@ -427,6 +428,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "KINWebBrowserExample/KINWebBrowserExample-Prefix.pch";
INFOPLIST_FILE = "KINWebBrowserExample/KINWebBrowserExample-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@@ -441,6 +443,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "KINWebBrowserExample/KINWebBrowserExample-Prefix.pch";
INFOPLIST_FILE = "KINWebBrowserExample/KINWebBrowserExample-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
diff --git a/ExampleProject/KINWebBrowserExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ExampleProject/KINWebBrowserExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 0000000..18d9810
--- /dev/null
+++ b/ExampleProject/KINWebBrowserExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/ExampleProject/KINWebBrowserExample/Images.xcassets/AppIcon.appiconset/Contents.json b/ExampleProject/KINWebBrowserExample/Images.xcassets/AppIcon.appiconset/Contents.json
index b7f3352..9221b9b 100644
--- a/ExampleProject/KINWebBrowserExample/Images.xcassets/AppIcon.appiconset/Contents.json
+++ b/ExampleProject/KINWebBrowserExample/Images.xcassets/AppIcon.appiconset/Contents.json
@@ -2,57 +2,97 @@
"images" : [
{
"idiom" : "iphone",
- "size" : "29x29",
- "scale" : "2x"
+ "scale" : "2x",
+ "size" : "20x20"
},
{
"idiom" : "iphone",
- "size" : "40x40",
- "scale" : "2x"
+ "scale" : "3x",
+ "size" : "20x20"
},
{
"idiom" : "iphone",
- "size" : "60x60",
- "scale" : "2x"
+ "scale" : "2x",
+ "size" : "29x29"
},
{
"idiom" : "iphone",
- "size" : "60x60",
- "scale" : "3x"
+ "scale" : "3x",
+ "size" : "29x29"
+ },
+ {
+ "idiom" : "iphone",
+ "scale" : "2x",
+ "size" : "40x40"
+ },
+ {
+ "idiom" : "iphone",
+ "scale" : "3x",
+ "size" : "40x40"
+ },
+ {
+ "idiom" : "iphone",
+ "scale" : "2x",
+ "size" : "60x60"
+ },
+ {
+ "idiom" : "iphone",
+ "scale" : "3x",
+ "size" : "60x60"
},
{
"idiom" : "ipad",
- "size" : "29x29",
- "scale" : "1x"
+ "scale" : "1x",
+ "size" : "20x20"
},
{
"idiom" : "ipad",
- "size" : "29x29",
- "scale" : "2x"
+ "scale" : "2x",
+ "size" : "20x20"
},
{
"idiom" : "ipad",
- "size" : "40x40",
- "scale" : "1x"
+ "scale" : "1x",
+ "size" : "29x29"
},
{
"idiom" : "ipad",
- "size" : "40x40",
- "scale" : "2x"
+ "scale" : "2x",
+ "size" : "29x29"
},
{
"idiom" : "ipad",
- "size" : "76x76",
- "scale" : "1x"
+ "scale" : "1x",
+ "size" : "40x40"
},
{
"idiom" : "ipad",
- "size" : "76x76",
- "scale" : "2x"
+ "scale" : "2x",
+ "size" : "40x40"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "1x",
+ "size" : "76x76"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "2x",
+ "size" : "76x76"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "2x",
+ "size" : "83.5x83.5"
+ },
+ {
+ "idiom" : "ios-marketing",
+ "scale" : "1x",
+ "size" : "1024x1024"
}
],
"info" : {
- "version" : 1,
- "author" : "xcode"
+ "author" : "xcode",
+ "version" : 1
}
-}
\ No newline at end of file
+}
diff --git a/ExampleProject/Podfile b/ExampleProject/Podfile
index 063e61b..ce76fad 100644
--- a/ExampleProject/Podfile
+++ b/ExampleProject/Podfile
@@ -1,7 +1,7 @@
source 'https://github.com/CocoaPods/Specs.git'
xcodeproj 'KINWebBrowserExample.xcodeproj'
-platform :ios, :deployment_target => '7.0'
+platform :ios, :deployment_target => '8.0'
pod 'KINWebBrowser'
diff --git a/KINWebBrowser.podspec b/KINWebBrowser.podspec
index 95d971d..745c86d 100644
--- a/KINWebBrowser.podspec
+++ b/KINWebBrowser.podspec
@@ -2,16 +2,16 @@
Pod::Spec.new do |s|
s.name = "KINWebBrowser"
- s.version = "1.3.2"
+ s.version = "1.3.3"
s.summary = "A web browser module for your apps."
s.description = <<-DESC
- KINWebBrowser is a web browser module for your apps. Powered by WKWebView on iOS 8. Backwards compatible with iOS 7 using UIWebView. KINWebBrowser offers the simplest way to add a web browser to your apps.
+ KINWebBrowser is a web browser module for your apps. Powered by WKWebView on iOS 8. KINWebBrowser offers the simplest way to add a web browser to your apps.
DESC
s.homepage = "https://github.com/dfmuir/KINWebBrowser"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "David F. Muir V" => "dfmuir@gmail.com" }
- s.platform = :ios, '7.0'
+ s.platform = :ios, '8.0'
s.source = { :git => "https://github.com/dfmuir/KINWebBrowser.git", :tag => s.version.to_s }
s.source_files = 'KINWebBrowser', 'KINWebBrowser/**/*.{h,m}'
s.resources = "Assets/*.png"
diff --git a/KINWebBrowser/KINWebBrowserViewController.h b/KINWebBrowser/KINWebBrowserViewController.h
index 64a5087..d45206a 100644
--- a/KINWebBrowser/KINWebBrowserViewController.h
+++ b/KINWebBrowser/KINWebBrowserViewController.h
@@ -64,7 +64,7 @@
For convenience, two sets of static initializers are available.
*/
-@interface KINWebBrowserViewController : UIViewController
+@interface KINWebBrowserViewController : UIViewController
#pragma mark - Public Properties
@@ -76,9 +76,8 @@
// The web views
// Depending on the version of iOS, one of these will be set
@property (nonatomic, strong) WKWebView *wkWebView;
-@property (nonatomic, strong) UIWebView *uiWebView;
-- (id)initWithConfiguration:(WKWebViewConfiguration *)configuration NS_AVAILABLE_IOS(8_0);
+- (id)initWithConfiguration:(WKWebViewConfiguration *)configuration;
#pragma mark - Static Initializers
@@ -91,7 +90,7 @@
*/
+ (KINWebBrowserViewController *)webBrowser;
-+ (KINWebBrowserViewController *)webBrowserWithConfiguration:(WKWebViewConfiguration *)configuration NS_AVAILABLE_IOS(8_0);
++ (KINWebBrowserViewController *)webBrowserWithConfiguration:(WKWebViewConfiguration *)configuration;
/*
Initialize a UINavigationController with a KINWebBrowserViewController for modal presentation.
@@ -102,7 +101,7 @@
*/
+ (UINavigationController *)navigationControllerWithWebBrowser;
-+ (UINavigationController *)navigationControllerWithWebBrowserWithConfiguration:(WKWebViewConfiguration *)configuration NS_AVAILABLE_IOS(8_0);
++ (UINavigationController *)navigationControllerWithWebBrowserWithConfiguration:(WKWebViewConfiguration *)configuration;
@property (nonatomic, strong) UIBarButtonItem *actionButton;
diff --git a/KINWebBrowser/KINWebBrowserViewController.m b/KINWebBrowser/KINWebBrowserViewController.m
index 5355114..f3524bc 100644
--- a/KINWebBrowser/KINWebBrowserViewController.m
+++ b/KINWebBrowser/KINWebBrowserViewController.m
@@ -41,10 +41,7 @@ @interface KINWebBrowserViewController ()
@property (nonatomic, assign) BOOL previousNavigationControllerToolbarHidden, previousNavigationControllerNavigationBarHidden;
@property (nonatomic, strong) UIBarButtonItem *backButton, *forwardButton, *refreshButton, *stopButton, *fixedSeparator, *flexibleSeparator;
-@property (nonatomic, strong) NSTimer *fakeProgressTimer;
@property (nonatomic, strong) UIPopoverController *actionPopoverController;
-@property (nonatomic, assign) BOOL uiWebViewIsLoading;
-@property (nonatomic, strong) NSURL *uiWebViewCurrentURL;
@property (nonatomic, strong) NSURL *URLToLaunchWithPermission;
@property (nonatomic, strong) UIAlertView *externalAppPermissionAlertView;
@@ -91,18 +88,14 @@ - (id)init {
- (id)initWithConfiguration:(WKWebViewConfiguration *)configuration {
self = [super init];
if(self) {
- if([WKWebView class]) {
- if(configuration) {
- self.wkWebView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration];
- }
- else {
- self.wkWebView = [[WKWebView alloc] init];
- }
+ if(configuration) {
+ self.wkWebView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration];
}
else {
- self.uiWebView = [[UIWebView alloc] init];
+ self.wkWebView = [[WKWebView alloc] init];
}
+
self.actionButtonHidden = NO;
self.showsURLInNavigationBar = NO;
self.showsPageTitleInNavigationBar = YES;
@@ -121,28 +114,16 @@ - (void)viewDidLoad {
self.previousNavigationControllerToolbarHidden = self.navigationController.toolbarHidden;
self.previousNavigationControllerNavigationBarHidden = self.navigationController.navigationBarHidden;
- if(self.wkWebView) {
- [self.wkWebView setFrame:self.view.bounds];
- [self.wkWebView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
- [self.wkWebView setNavigationDelegate:self];
- [self.wkWebView setUIDelegate:self];
- [self.wkWebView setMultipleTouchEnabled:YES];
- [self.wkWebView setAutoresizesSubviews:YES];
- [self.wkWebView.scrollView setAlwaysBounceVertical:YES];
- [self.view addSubview:self.wkWebView];
-
- [self.wkWebView addObserver:self forKeyPath:NSStringFromSelector(@selector(estimatedProgress)) options:0 context:KINWebBrowserContext];
- }
- else if(self.uiWebView) {
- [self.uiWebView setFrame:self.view.bounds];
- [self.uiWebView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
- [self.uiWebView setDelegate:self];
- [self.uiWebView setMultipleTouchEnabled:YES];
- [self.uiWebView setAutoresizesSubviews:YES];
- [self.uiWebView setScalesPageToFit:YES];
- [self.uiWebView.scrollView setAlwaysBounceVertical:YES];
- [self.view addSubview:self.uiWebView];
- }
+ [self.wkWebView setFrame:self.view.bounds];
+ [self.wkWebView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
+ [self.wkWebView setNavigationDelegate:self];
+ [self.wkWebView setUIDelegate:self];
+ [self.wkWebView setMultipleTouchEnabled:YES];
+ [self.wkWebView setAutoresizesSubviews:YES];
+ [self.wkWebView.scrollView setAlwaysBounceVertical:YES];
+ [self.view addSubview:self.wkWebView];
+
+ [self.wkWebView addObserver:self forKeyPath:NSStringFromSelector(@selector(estimatedProgress)) options:0 context:KINWebBrowserContext];
self.progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
@@ -169,19 +150,13 @@ - (void)viewWillDisappear:(BOOL)animated {
[self.navigationController setToolbarHidden:self.previousNavigationControllerToolbarHidden animated:animated];
- [self.uiWebView setDelegate:nil];
[self.progressView removeFromSuperview];
}
#pragma mark - Public Interface
- (void)loadRequest:(NSURLRequest *)request {
- if(self.wkWebView) {
- [self.wkWebView loadRequest:request];
- }
- else if(self.uiWebView) {
- [self.uiWebView loadRequest:request];
- }
+ [self.wkWebView loadRequest:request];
}
- (void)loadURL:(NSURL *)URL {
@@ -194,12 +169,7 @@ - (void)loadURLString:(NSString *)URLString {
}
- (void)loadHTMLString:(NSString *)HTMLString {
- if(self.wkWebView) {
- [self.wkWebView loadHTMLString:HTMLString baseURL:nil];
- }
- else if(self.uiWebView) {
- [self.uiWebView loadHTMLString:HTMLString baseURL:nil];
- }
+ [self.wkWebView loadHTMLString:HTMLString baseURL:nil];
}
- (void)setTintColor:(UIColor *)tintColor {
@@ -220,61 +190,6 @@ - (void)setActionButtonHidden:(BOOL)actionButtonHidden {
[self updateToolbarState];
}
-
-#pragma mark - UIWebViewDelegate
-
-- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
- if(webView == self.uiWebView) {
-
- if(![self externalAppRequiredToOpenURL:request.URL]) {
- self.uiWebViewCurrentURL = request.URL;
- self.uiWebViewIsLoading = YES;
- [self updateToolbarState];
-
- [self fakeProgressViewStartLoading];
-
- if([self.delegate respondsToSelector:@selector(webBrowser:didStartLoadingURL:)]) {
- [self.delegate webBrowser:self didStartLoadingURL:request.URL];
- }
- return YES;
- }
- else {
- [self launchExternalAppWithURL:request.URL];
- return NO;
- }
- }
- return NO;
-}
-
-- (void)webViewDidFinishLoad:(UIWebView *)webView {
- if(webView == self.uiWebView) {
- if(!self.uiWebView.isLoading) {
- self.uiWebViewIsLoading = NO;
- [self updateToolbarState];
-
- [self fakeProgressBarStopLoading];
- }
-
- if([self.delegate respondsToSelector:@selector(webBrowser:didFinishLoadingURL:)]) {
- [self.delegate webBrowser:self didFinishLoadingURL:self.uiWebView.request.URL];
- }
- }
-}
-
-- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
- if(webView == self.uiWebView) {
- if(!self.uiWebView.isLoading) {
- self.uiWebViewIsLoading = NO;
- [self updateToolbarState];
-
- [self fakeProgressBarStopLoading];
- }
- if([self.delegate respondsToSelector:@selector(webBrowser:didFailToLoadURL:error:)]) {
- [self.delegate webBrowser:self didFailToLoadURL:self.uiWebView.request.URL error:error];
- }
- }
-}
-
#pragma mark - WKNavigationDelegate
- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation {
@@ -348,8 +263,8 @@ - (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWe
- (void)updateToolbarState {
- BOOL canGoBack = self.wkWebView.canGoBack || self.uiWebView.canGoBack;
- BOOL canGoForward = self.wkWebView.canGoForward || self.uiWebView.canGoForward;
+ BOOL canGoBack = self.wkWebView.canGoBack;
+ BOOL canGoForward = self.wkWebView.canGoForward;
[self.backButton setEnabled:canGoBack];
[self.forwardButton setEnabled:canGoForward];
@@ -359,17 +274,11 @@ - (void)updateToolbarState {
}
NSArray *barButtonItems;
- if(self.wkWebView.loading || self.uiWebViewIsLoading) {
+ if(self.wkWebView.loading) {
barButtonItems = @[self.backButton, self.fixedSeparator, self.forwardButton, self.fixedSeparator, self.stopButton, self.flexibleSeparator];
if(self.showsURLInNavigationBar) {
- NSString *URLString;
- if(self.wkWebView) {
- URLString = [self.wkWebView.URL absoluteString];
- }
- else if(self.uiWebView) {
- URLString = [self.uiWebViewCurrentURL absoluteString];
- }
+ NSString *URLString = [self.wkWebView.URL absoluteString];
URLString = [URLString stringByReplacingOccurrencesOfString:@"http://" withString:@""];
URLString = [URLString stringByReplacingOccurrencesOfString:@"https://" withString:@""];
@@ -381,12 +290,7 @@ - (void)updateToolbarState {
barButtonItems = @[self.backButton, self.fixedSeparator, self.forwardButton, self.fixedSeparator, self.refreshButton, self.flexibleSeparator];
if(self.showsPageTitleInNavigationBar) {
- if(self.wkWebView) {
- self.navigationItem.title = self.wkWebView.title;
- }
- else if(self.uiWebView) {
- self.navigationItem.title = [self.uiWebView stringByEvaluatingJavaScriptFromString:@"document.title"];
- }
+ self.navigationItem.title = self.wkWebView.title;
}
}
@@ -430,57 +334,29 @@ - (void)doneButtonPressed:(id)sender {
#pragma mark - UIBarButtonItem Target Action Methods
- (void)backButtonPressed:(id)sender {
-
- if(self.wkWebView) {
- [self.wkWebView goBack];
- }
- else if(self.uiWebView) {
- [self.uiWebView goBack];
- }
+ [self.wkWebView goBack];
[self updateToolbarState];
}
- (void)forwardButtonPressed:(id)sender {
- if(self.wkWebView) {
- [self.wkWebView goForward];
- }
- else if(self.uiWebView) {
- [self.uiWebView goForward];
- }
+ [self.wkWebView goForward];
[self updateToolbarState];
}
- (void)refreshButtonPressed:(id)sender {
- if(self.wkWebView) {
- [self.wkWebView stopLoading];
- [self.wkWebView reload];
- }
- else if(self.uiWebView) {
- [self.uiWebView stopLoading];
- [self.uiWebView reload];
- }
+ [self.wkWebView stopLoading];
+ [self.wkWebView reload];
}
- (void)stopButtonPressed:(id)sender {
- if(self.wkWebView) {
- [self.wkWebView stopLoading];
- }
- else if(self.uiWebView) {
- [self.uiWebView stopLoading];
- }
+ [self.wkWebView stopLoading];
}
- (void)actionButtonPressed:(id)sender {
NSURL *URLForActivityItem;
NSString *URLTitle;
- if(self.wkWebView) {
- URLForActivityItem = self.wkWebView.URL;
- URLTitle = self.wkWebView.title;
- }
- else if(self.uiWebView) {
- URLForActivityItem = self.uiWebView.request.URL;
- URLTitle = [self.uiWebView stringByEvaluatingJavaScriptFromString:@"document.title"];
- }
+ URLForActivityItem = self.wkWebView.URL;
+ URLTitle = self.wkWebView.title;
if (URLForActivityItem) {
dispatch_async(dispatch_get_main_queue(), ^{
TUSafariActivity *safariActivity = [[TUSafariActivity alloc] init];
@@ -532,43 +408,6 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
}
}
-
-#pragma mark - Fake Progress Bar Control (UIWebView)
-
-- (void)fakeProgressViewStartLoading {
- [self.progressView setProgress:0.0f animated:NO];
- [self.progressView setAlpha:1.0f];
-
- if(!self.fakeProgressTimer) {
- self.fakeProgressTimer = [NSTimer scheduledTimerWithTimeInterval:1.0f/60.0f target:self selector:@selector(fakeProgressTimerDidFire:) userInfo:nil repeats:YES];
- }
-}
-
-- (void)fakeProgressBarStopLoading {
- if(self.fakeProgressTimer) {
- [self.fakeProgressTimer invalidate];
- }
-
- if(self.progressView) {
- [self.progressView setProgress:1.0f animated:YES];
- [UIView animateWithDuration:0.3f delay:0.3f options:UIViewAnimationOptionCurveEaseOut animations:^{
- [self.progressView setAlpha:0.0f];
- } completion:^(BOOL finished) {
- [self.progressView setProgress:0.0f animated:NO];
- }];
- }
-}
-
-- (void)fakeProgressTimerDidFire:(id)sender {
- CGFloat increment = 0.005/(self.progressView.progress + 0.2);
- if([self.uiWebView isLoading]) {
- CGFloat progress = (self.progressView.progress < 0.75f) ? self.progressView.progress + increment : self.progressView.progress + 0.0005;
- if(self.progressView.progress < 0.95) {
- [self.progressView setProgress:progress animated:YES];
- }
- }
-}
-
#pragma mark - External App Support
- (BOOL)externalAppRequiredToOpenURL:(NSURL *)URL {
@@ -616,9 +455,7 @@ - (BOOL)shouldAutorotate {
#pragma mark - Dealloc
-- (void)dealloc {
- [self.uiWebView setDelegate:nil];
-
+- (void)dealloc {
[self.wkWebView setNavigationDelegate:nil];
[self.wkWebView setUIDelegate:nil];
if ([self isViewLoaded]) {
diff --git a/README.md b/README.md
index 573f037..d12eef2 100644
--- a/README.md
+++ b/README.md
@@ -3,13 +3,13 @@ KINWebBrowser
KINWebBrowser is a web browser module for your apps.
-Powered by [WKWebView](https://developer.apple.com/library/IOs/documentation/WebKit/Reference/WKWebView_Ref/index.html) on iOS 8. Backwards compatible with iOS 7 using [UIWebView](https://developer.apple.com/library/ios/documentation/Uikit/reference/UIWebView_Class/index.html).
+Powered by [WKWebView](https://developer.apple.com/library/IOs/documentation/WebKit/Reference/WKWebView_Ref/index.html) on iOS 8.

Features
------------------------
-* iOS 7 & 8 support for iPhone and iPad devices
+* iOS 8 support for iPhone and iPad devices
* Safari-like interface
* Animated progress bar
* Customizable UI including tint color
@@ -53,7 +53,7 @@ Installation
###### Podfile
```ruby
-platform :ios, '7.0'
+platform :ios, '8.0'
pod 'KINWebBrowser'
```