Latest 0.2.1
Homepage https://github.com/Gobitech/Gobi-IOS-SDK
License MIT
Platforms ios 10.0
Authors

Version
License
Platform

Installation

GobiSDK is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'GobiSDK'

Get your access key

Get them from Gobitech AS on email, [email protected].

Integrate in the app

1. Import Gobi SDK

import GobiSDK

2. Initialize Gobi for example in view controller viewDidLoad()

override func viewDidLoad() {
    super.viewDidLoad()
    Gobi.with("ZDY5OGI0YZQ3MJG0MWE3ZDA0YWEXZDLK", delegate: self)
}

Note that delegate instance should conform to GobiDelegate protocol.

Delagate parameter is optional, so if it’s not required to get any callbacks initialization could look like

override func viewDidLoad() {
    super.viewDidLoad()
    Gobi.with("ZDY5OGI0YZQ3MJG0MWE3ZDA0YWEXZDLK")
}

3. Store your story keys

struct Stories {
    static var gobiTeamStoryId = "OWEXMJUWM2FKMTE5M2U3NWIXZTIZZDK0NJQ2NJUYNZRKOGZHNZM1ZJFINWVHMJBK"
}

Usage

1. Get info about a story

func loadStory() {
    Gobi.getStoryData(for: Stories.gobiTeamStoryId)
}

When story info is received the delegate method func didReceiveStory(_ story: GobiStory) is called.

2. Show a story

Use method Gobi.showStory(with id: String, from vc: UIViewController) to show new images and video for story id and present it on vc.

    Gobi.showStory(with: Stories.gobiTeamStoryId, from: self)

3. Rewind a story

Use method Gobi.rewindStory(with id: String, from vc: UIViewController) to show all available images and video for story id and present it on vc.

    Gobi.rewindStory(with: Stories.gobiTeamStoryId, from: self)

4. Check if story has new images and video to decide show or rewind

func showStory(_ story: GobiStory) {
    if story.unreadCount > 0 {
        Gobi.showStory(with: Stories.gobiTeamStoryId, from: self)
    } else {
        Gobi.rewindStory(with: Stories.gobiTeamStoryId, from: self)
    }
}

5. GobiDelegate

public protocol GobiDelegate {

    public func didReceiveStory(_ story: GobiStory)

    public func didFailWith(_ error: GobiError)

    public func didFinishShowingMedia()
}

public func didReceiveStory(_ story: GobiStory)

The method is called when story is retrived from Gobi after calling Gobi.getStoryData(for: Stories.gobiTeamStoryId)

public func didFailWith(_ error: GobiError)

The method is called when any requested action cannot be completed. GobiError is an enum:

public enum GobiError : Error, ErrorStringConvertible {

    case invalidCustomerId

    case invalidStoryKey

    case requestFailed(String)

    case failedToLoadStory

    case failedToLoadMedia

    case noNewImagesInStory

    case noImagesInStory

    public var errorDescription: String { get }
}

public func didFinishShowingMedia()

The method is called when GobiSDK finished playing story and controller is dismissed. If UI shows the GobiStory it could be good place to call getStoryData to load updated information like thumbnail, unread count, etc.

Usage Notes

1. To hide status bar on video player make sure View controller-based status bar appearance is set to YES in Info.plist file.

2. Make sure Info.plist containt App Transport Security Settings and Allow Arbitrary Loads is set to YES

Author

Gobitech

License

GobiSDK is available under the Apache 2.0 license. See the LICENSE file for more info.

Latest podspec

{
    "name": "GobiSDK",
    "version": "0.2.1",
    "summary": "The Gobi iOS SDK makes it quick and easy to integrate engaging and interactive story functionality in your iOS app",
    "description": "The Gobi iOS SDK makes it easy to integrate Gobi stories into your own appnnGobi stories:n-    Administer the user generated stories by allowing or declining contentn-    Keep content live for as long as you wantn-    Combine engaging stories with interactive voting/link stickers to lead more retention, traffic and commercen-    Analyticsn-    Web admin tool",
    "homepage": "https://github.com/Gobitech/Gobi-IOS-SDK",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Gobitech": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Gobitech/Gobi-IOS-SDK.git",
        "tag": "0.2.1"
    },
    "platforms": {
        "ios": "10.0"
    },
    "vendored_frameworks": "GobiSDK.framework"
}

Pin It on Pinterest

Share This