Skip to content

yehiabairm/RWPodSpecs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

Speakol iOS SDK

This repository contains the Speakol iOS SDK source.

Speakol provides endless scrolling of highly- personalized article recommendations, video-view inventory, featured content inventory and related inventory to each visitor on your website. Speakol’s technology seeks to understand visitors and place inventory of interest to them.

This guide is intended for publishers who want to use Speakol to monetize an iOS app that's built natively.

Features

  • Insert speakol inventory in UITableView
  • Insert speakol inventory in UICollectionView
  • Support Image/Video inventory

Prerequisite

  • iOS 11.0+

Background

See the Podfile Syntax Reference for instructions and options about overriding pod source locations.

Installation

Cocoapods

Install Cocoapods if need be.

$ gem install cocoapods

Add Speakol-SDK in your Podfile.

use_frameworks!

pod 'Speakol-SDK' # not published yet

Then, run the following command.

$ pod install

Supported Views

View
1. UITableView
2. UICollectionView

Example

Here is an example of enclosing Speakol Inventory in UITableView

Usage

Firstly, import Speakol SDK.

import Speakol

Then, add Speakol SDK initializers to the AppDelegate enclosed in the didFinishLaunchingWithOptions method:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
  SpeakolManager.shared.speakolToken = "token_from_speakol_portal"
  SpeakolManager.shared.widgetId = "widget_id"
  SpeakolManager.shared.initializeSpeakolWithToken()
  return true
}

Initialization for UITableView

  • In the storyboard, change the class of the designated UITableView to SpeakolTableView.

Note: Set Module to Speakol.

Configure SpeakolTableView

  • First you need to implement SpeakolTableViewDelegate, and SpeakolTableViewDataSource like this:
class ViewController: UIViewController, SpeakolTableViewDelegate, SpeakolTableViewDataSource
  • Then you need to set speakolDelegate, and speakolDataSource
speakolTableView.speakolDelegate = self
speakolTableView.speakolDataSource = self
  • Use those two Speakol methods instead of the original ones.
func speakolTableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  return number_of_your_items_want_to_be_displayed // not the speakol items will be inserted in another section this section is used for the publisher items only
}
func speakolTableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  // here you will return the any tableview cell you want to dispaly
  let cell = speakolTableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as UITableViewCell
  return cell
}

Also if you want to add speakol inventory to the top of your SpeakolTableView set SpeakolTableView.isTop = true

And for the publishers who have already existing UICollectionView you can update it to:

  • By storyboard, changing class of any UICollectionView to SpeakolCollectionView.

Note: Set Module to Speakol.

Configure SpeakolCollectionView

  • First you need to implement SpeakolCollectionViewDelegate, SpeakolCollectionViewDataSource, and SpeakolCollectionViewDelegateFlowLayout like this:
class ViewController: UIViewController, SpeakolCollectionViewDelegate, SpeakolCollectionViewDataSource, SpeakolCollectionViewDelegateFlowLayout
  • Then you need to set speakolDelegate, speakolDataSource, and speakolDelegateFlowLayout
collectionView.speakolDelegate = self
collectionView.speakolDataSource = self
collectionView.speakolDelegateFlowLayout = self
  • Then implement this method like native collectionView
func speakolCollectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return number_of_your_items_want_to_be_displayed // not the speakol items will be inserted in another section this section is used for the publisher items only
}
    
    func speakolCollectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "VideoCollectionViewCell", for: indexPath) as! UICollectionViewCell
        return cell
}
    
    func speakolCollectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
        let collectionCellSize = collectionView.frame.size.width
        return CGSize(width: collectionCellSize/2, height: 100)
}

By then you can enjoy Speakol customized content. Please, refer back to Speakol publisher portal for more customization.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages