Code Monkey home page Code Monkey logo

towebviewcontroller's Introduction

TOWebViewController

An Inline Web Browser for iOS Apps

TOCropViewController

CI Status Version License Platform

TOWebViewController is an open-source UIViewController subclass designed to let apps quickly present web page content to its users, without needing to kick them over to Safari. TOWebViewController has been designed from the ground up to be easily integrated into existing projects, to take advantage of the latest features of iOS, and to optionally be backwards compatible with (significantly) earlier versions of iOS.

Features

  • Powered by UIWebView, backwards compatible down to iOS 5.
  • Full navigation buttons set, including back, forward, refresh and an optional share/action button.
  • Detects whether being pushed modally, or via a navigation controller and adjusts the UI accordingly.
  • A page load progress bar (using ninjinkun's amazing algorithm).
  • Plays a smooth, elegant rotation animation if/when the user rotates the device.
  • Icons are procedurally generated by CoreGraphics (ie, no unnecessary image assets at all!).
  • Compatible with iOS 8 size classes, including split-screen on iPad Air 2, iPad mini 4 and iPad Pro.
  • 1Password automatic password input extension support.
  • (TODO) Reimplement the popup that appears when users tap and hold a link for added flexibility.
  • (TODO) An optional text field for which users may manually enter in a URL.
  • (TODO) A proper delegate system to allow external classes to interact with this controller.
  • (TODO) A rudimentary bookmark saving and retrieval system.
  • (TODO) Basic navigation history that displays when long-pressing the back/forward buttons.
  • (TODO) A proper 'Error Occurred/Not connected to the internet' dialog view.

Example

TOWebViewController is smart enough to be able to tell when it's being presented as a modal popup, and when it's being pushed onto a UINavigationController and to change its button layout accordingly.

Presenting as a Modal Dialog

When presenting as a modal popup, it is still necessary to create a parent UINavigationController in order for the buttons to display properly:

TOWebViewController *webViewController = [[TOWebViewController alloc] initWithURL:[NSURL URLWithString:@"http://www.apple.com/"]];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:webViewController];
[self presentViewController:navigationController animated:YES completion:nil];

Pushing onto a UINavigationController

TOWebViewController *webViewController = [[TOWebViewController alloc] initWithURL:[NSURL URLWithString:@"http://www.apple.com/"]];
[self.navigationController pushViewController:webViewController animated:YES];

System Requirements

iOS 5.0 or above

Installation

As a Cocoapods Dependency

Add the following to your Podfile:

pod 'TOWebViewController'

Manual Installation

Download this project from GitHub, move the subfolder named 'TOWebViewController' over to your project folder, and drag it into your Xcode project.

After that, you'll need to link the following system frameworks to your project:

  • QuartzCore.framework
  • CoreGraphics.framework
  • MessageUI.framework
  • Twitter.framework

Why no WKWebView adoption?

While WKWebView does look much nicer than UIWebView, it has several show-stopping issues. Most importantly, session and cookie data that is created inside a WKWebView isn't accessible by the rest of the Foundation framework. Since a large goal in building this project was to allow users to log into web accounts and subsequently use that session to download files, this is simply unacceptable.

TOWebViewController will not be adopting WKWebView at any point in the future. If you would like an alternative view controller that does, please give DZNWebViewController a try!

What about SFSafariViewController?

Starting from iOS 9, Apple now provides a built-in web view controller of similar functionality named SFSafariViewController. If your app is only targeting iOS 9, and it completely fills your requirements, then it is absolutely recommended that you adopt SFSafariViewController instead of TOWebViewController.

That being said, if you are still targeting lower iOS versions, or require more customisability than SFSafariViewController provides, then TOWebViewController can still serve as a viable alternative.

Credits

TOWebViewController was originally created by Tim Oliver as a component for iComics, a comic reader app for iOS.

Thanks also goes to TOWebViewController's growing list of contributors!

License

TOWebViewController is licensed under the MIT License. For more information, please see the LICENSE file.

towebviewcontroller's People

Contributors

buh avatar cfiorini avatar dkhamsing avatar fulldecent avatar hyperspacemark avatar jeremypiednoel avatar kevin-lyn avatar masawo avatar mclkyo avatar melsam avatar metasmile avatar mvasilak avatar plu avatar sapzildj avatar sarstw avatar sergii-frost avatar stephpaquet avatar timoliver avatar uzegonemad avatar yoyoworms avatar zachchen avatar

Stargazers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.