Awesome Open Source
Awesome Open Source

FLWebView Build Status

Note: This repository was written in Objective-C. A Swift version is available here.

This is an example Xcode project demonstrating how to use WKWebView in iOS 8 with a UIWebView fallback for earlier versions of iOS. A full discussion of this code is available here. Basically, we created a protocol that unifies the functionality we'd like to have in a WebView, and then created categories that ensure we have the proper methods in our UIWebView and WKWebView classes.

These are used in the ViewController viewDidLoad method to create a web view and add it to the active view. The code checks for WKWebKit and, if present, uses WKWebView. If it's not there, it defaults to UIWebView.


This is an example project but you should be able to build and test it with little setup. Obviously, as this is an iOS project the following steps apply to OS X. Assuming you have Ruby you can install homebrew if you don't have it already (just enter this in the terminal):

ruby -e "$(curl -fsSL"

Then you can install xctool, Facebook's neat open source Xcode build tool:

brew install xctool

After that, you can run the script to build and test:


There you go! Of course, you can this in Xcode, but this setup is great if you want to do some continuous integration, as Travis already has xctool installed by default.


If you're getting code signing errors with an Objective-C project in Travis, make sure that your build script specifies -sdk iphonesimulator and -test-sdk iphonesimulator. Also, if your .travis.yml file targets the script you're using locally (in our case, .travis.yml specifies script: sh it makes the debug process a bit simpler.


As the goal of this project was not to create an example of good iOS testing, the tests for this repository are very minimal and largely serve largely to verify that we can build and deploy the application without issue. There are some tests to verify that we can instantiate a web view, but these are not particularly robust. You can find good information on unit testing in iOS from Apple's iOS Developer Library here.


  • travis-ci - Automated unit testing.
  • travis-lint - Local Travis settings validation.
  • xctool - Command-line iOS build scripts.
  • homebrew - OS X package management, used to install xctool.
  • ruby gem - Ruby package management, used to install travis-lint.



© 2014 Float. Shared under an MIT license. See for details.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Objective C (110,692
Xcode (2,384
Related Projects