WordPressCom-Stats-iOS 0.9.1

WordPressCom-Stats-iOS 0.9.1

LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Sep 2018

Maintained by Danilo Ercoli, Eric Johnson, Eric Johnson, Jorge Bernal, Jorge Leandro Perez, Matt Bumgardner, Aaron Douglas, Diego Rey Mendez, Sérgio Estêvão, James Frost, Elisa Budelli, Enej Bajgoric, Antonis Lilis, Ernesto Carrion, Paolo Musolino, Gerardo Pacheco, Brandon Titus, Evgeny Shurakov, Wendy Chen, Olivier Halligon, Diego Rey Mendez, Cesar Tardaguila, Eduardo Toledo, Stephenie Harris, Thuy Copeland, Lorenzo Mattei, Daniele Bogo, Jaclyn Chen, Chip Snyder, Jeremy Massel, Pinar Olguc, Emily Laguna, Leandro Alonso, Paul Von Schrottky, Stefanos Togoulidis, Ceyhun Ozugur, Allen Snook, Giovanni Lodi, Jayson Basañes, Rachel McRoberts, Momo Ozawa, Yael Rubinstein, Giorgio Ruscigno, Automattic Mobile.

Depends on:
AFNetworking~> 3.1.0
CocoaLumberjack~> 2.2.0
WordPress-iOS-Shared~> 0.5
NSObject-SafeExpectations~> 0.0.2
WordPressCom-Analytics-iOS~> 0.1.4

Build Status

WordPress Logo


WordPressCom-Stats-iOS Screenshot


WordPressCom-Stats-iOS is a reusable component used in the WordPress iOS app to show stats for sites hosted on WordPress.com. You can use the UIViewController subclass inside of your own applications or use one of the services to pull stats for your own use.

How to get started

You can install the stats component in your app via CocoaPods:

platform :ios, '10.0'
pod 'WordPressCom-Stats-iOS'

Or, you can just try out the demo by using the CocoaPods try command:

pod try WordPressCom-Stats-iOS


WordPressCom-Stats-iOS requires iOS 7.0 or higher and ARC. It depends on the following Apple frameworks:

  • Foundation.framework
  • UIKit.framework
  • CoreGraphics.framework

and the following CocoaPods:

See the podspec for more details.


There are three things that you need to do in order to use WordPressCom-Stats-iOS in your app.

  1. Create a UIViewController subclass that extends WPStatsViewController. (Optionally you may choose to use composition and have your UIViewController contain an instance of WPStatsViewController and add as a subview. Take a look at the demo project for an example.)

     #import <UIKit/UIKit.h>
     #import <WordPressCom-Stats-iOS/WPStatsViewController.h>
     @interface WPViewController : WPStatsViewController <WPStatsViewControllerDelegate>
  2. Obtain an OAuth2 token from WordPress.com. Currently the authentication mechanism to WordPress.com is not part of a reusable library. You will need to obtain this manually by following (these directions)[https://developer.wordpress.com/docs/oauth2/]. The easiest way to snag the OAuth2 token is by setting a breakpoint in the WordPress-iOS application after generating a token.

  3. Obtain the site/blog ID for the site you wish to view stats for.

  4. Pass the site ID and OAuth2 token to either the init method or set as parameters before displaying the view from the controller.

For more details, you can review the StatsDemo project included in this repo.

Other Resources

Developer blog & Handbook

Blog: http://make.wordpress.org/mobile

Handbook: http://make.wordpress.org/mobile/handbook/

Style guide


To report an issue (for the stats component only)


Source Code

GitHub: https://github.com/wordpress-mobile/WordPressCom-Stats-iOS/

How to Contribute


Future Enhancements

  • Replace networking stack with WordPressComApi shared pod


WordPressCom-Stats-iOS is available under the MIT license. See the LICENSE file for more info.