iOS app with UIWebView implemented and JS calls Objective-C methods
Objective-C CSS JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
NewsMate Hybrid.xcodeproj
NewsMate Hybrid
NewsMate HybridTests

Hybrid iOS App

This is a sample how to connect an iOS app and server-side web pages. For this sample a news aggregator is built. To keep it simple the backend is using Yahoo Pipes, which aggregates different news web pages. It's requesting RSS feeds and also scraping HTML by some online news returning JSON. NewsMate Hybrid App

Clone Repo

git clone

Up and Running

  1. Copy all files in /Server to your web server.
  2. In WebViewController.m line 52 change the path [self loadPageWithURL:@"http://newsmate"]; where you have stored the /Server files.
  3. Run iOS Simulator.

Next Steps

  1. Add another UIViewController in front of loaded news snippets. A list or table to select different news sources. This also should be an UIWebView requesting a list with topics and/or online news papers.
  2. Refactor the - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest method, also create required classes. Review architecture issues.
  3. Implement the Observer design pattern and find an approach to listen, observe or notify - also called Broadcaster/Listener, Publish/Subscribe or Notifications.

Hybrid Apps

  • Cross platform code
  • Rapid development
  • Instant updates
  • Bad Performance - 3x slower, JS Engine Nitro isn't supported in UIWebView
  • Presentation and layout issues
  • JS Execution time is limited (10s on iOS)


  • High Performance - best for hardware intensive operations, iOS JavaScriptCore
  • Native user experience - effects and animations
  • Mobile Safari has better caching and asynchronous multithreading


  • UIWebView Bridge - PhoneGap,
  • Custom JavaScriptCore - Appcelerator Titanium
  • Gaming - Spaceport, ImpactJS, CocoonJS

JS to Objective-C

[webViewObject stringByEvaluatingJavaScriptFromString:@"myJavascriptFunction()"];


  • Native Code is ~3x faster than JS (ranges in 2x-9x)
  • MBP vs. iPhone is a factor of 10.
  • The performance between Chrome 8 and Chrome 29 is a flatline. If the web feels faster, that is probably because you’re running a faster computer, but it has nothing to do with improvements to Chrome.

iOS Safari Browser UIWebView Browser

Apple Documentation

"JavaScript execution time is limited to 10 seconds for each top-level entry point. If your script executes for more than 10 seconds, the web view stops executing the script. This is likely to occur at a random place in your code, so unintended consequences may result. This limit is imposed because JavaScript execution may cause the main thread to block, so when scripts are running, the user is not able to interact with the webpage. JavaScript allocations are also limited to 10 MB. The web view raises an exception if you exceed this limit on the total memory allocation for JavaScript."

Google about JS

They think that JavaScript is facing a performance wall: "Complex web apps–the kind that Google specializes in–are struggling against the platform and working with a language that cannot be tooled and has inherent performance problems."

Read more