Latest 0.1.22
Homepage https://github.com/localmeasure/LocalMeasureWidgetKit
License MIT
Platforms ios 8.0
Dependencies Alamofire, ObjectMapper
Authors

CocoaPods
Build Status
Twitter URL

Local Measure

Local Measure Widget Kit

Quickly and easily integrate your Local Measure widgets to your app.


Features

  • [x] Get a list of your widgets as an array of LMWidget.
  • [x] Get a list of a widget’s posts as an array of LMPost.

Requirements

  • iOS 8.0+
  • Xcode 7.3+

Get in touch

If you are a Local Measure customer and need help setting up your widget integration, please get in touch with [email protected]

If your are not a Local Measure client, you will find our contact page here: getlocalmeasure.com/contact


Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 0.39.0+ is required to build LocalMeasureWidgetKit 0.1.0+.

To integrate LocalMeasureWidgetKit into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'LocalMeasureWidgetKit', '~> 0.1.21'

Then, run the following command:

$ pod install

Usage

Initial setup

Start by importing the LocalMeasureWidgetKit module in your AppDelegate

import LocalMeasureWidgetKit

In your func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool, call func setup(userHash: String) passing your user hash as an argument.

This will store your user hash so you don’t have to pass it every time you make a request to the Local Measure API.

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
  LMWidgetKit().setup("<USER_HASH>")
  return true
}

Listing widgets

To get your list of widgets you simply need to call widgets(success: (widgets: [LMWidget]) -> Void, failure: (error: NSError) -> Void) and pass it both a success and failure closure to handle the possible results.

LMWidgetKit().widgets({ (widgets) -> Void in
  print(widgets)
}, failure: { (error) -> Void in
  print(error)
})

Listing a widget’s posts

To list a widget’s posts, call func posts(widgetHash: String, success: (posts: [LMPost]) -> Void, failure: (error: NSError) -> Void), pass it the widget’s hash and both a success and failure closure to handle the possible results.

LMWidgetKit().posts("<WIDGET_HASH>", success: { (posts) -> Void in
  print(posts)
}, failure: { (error) -> Void in
  print(error)
})

Detailed documentation

A detailed documentation of the LMWidgetKit class and the module’s types can be found here. (work in progress)

Latest podspec

{
    "name": "LocalMeasureWidgetKit",
    "version": "0.1.22",
    "summary": "Quick and easy Local Measure widget integration.",
    "description": "This CocoaPod provides the ability to integrate Local Measure Widgets to your app quickly and easily.",
    "homepage": "https://github.com/localmeasure/LocalMeasureWidgetKit",
    "license": "MIT",
    "authors": {
        "solal": "[email protected]"
    },
    "source": {
        "git": "https://github.com/localmeasure/LocalMeasureWidgetKit.git",
        "tag": "0.1.22"
    },
    "social_media_url": "https://twitter.com/localmeasure",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "LocalMeasureWidgetKit/*.swift",
    "resource_bundles": {
        "LocalMeasureWidgetKit": [
            "LocalMeasureWidgetKit/Assets/*.png"
        ]
    },
    "dependencies": {
        "Alamofire": [
            "~> 3.3"
        ],
        "ObjectMapper": [
            "~> 1.2"
        ]
    }
}

Pin It on Pinterest

Share This