Widgets - GluedIn
GluedIn widget
GluedIn provide widgets which can be used inside a new or any existing application with predefine line of code, almost no development experience required to use widget inside your application. Below are the available widgets which can be used in your application:
  • Profile (Top profile)
  • Videos (Fresh arrival videos)
  • Hashtags
  • Challenges
Pre-Requisites
Please refer the pre-requisites as provided in the Getting Started section.
Steps to integrate:
Below are the define steps to follow if you want to integrate GluedIn Widget in your application.
  • Create Rail TableViewCell with CustomRailView and Xib.
  • import GluedInSDK
  • Add UIView at Xib with CustomRailView class. as shown in below code snippet:
  
import UIKit
import GluedInSDK

class RailTableViewCell: UITableViewCell {
    @IBOutlet weak var railView: CustomRailView!
    override func awakeFromNib() {
        super.awakeFromNib()
    }
}
 
Rail TableViewCell implemented tableview.
Below are the Implementation Steps for rail in tableview cell “RailTableViewCell”.
  • Set Rail type on tableview cell cell.railView.railType = .profile
  • Set heightForRowAtindexPath According to RailType CustomRailView.getContentViewHeightByCellType(cellType: .profile)
  
import UIKit
import GluedInSDK

class SampleRailViewController: UIViewController,
                                UITableViewDelegate,
                                UITableViewDataSource {
    
    @IBOutlet weak var tableView: UITableView!
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        /*
        Generate the cell object as per your design model
        */
        // Call rail view type what ever you wanted to load
        // . profile
        // .trendingHashtag
        // .video
        
        cell.railView.railType = .profile
        return cell
    }
    
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        switch indexPath.row {
        case 0:
            return CustomRailView.getContentViewHeightByCellType(cellType: .profile)
        case 1:
            return CustomRailView.getContentViewHeightByCellType(cellType: .trendingHashtag)
        default:
            return CustomRailView.getContentViewHeightByCellType(cellType: .profile)
        }
    }
}
  
Protocol Method:
If user confirm delegate then he will get below callbacks. Class Name: railDelegate Available Callback Methods: Below are the methods which will be triggered on item action click and view all click.
fun railItemAction(currentClickItem: railItem, Type: Int, Index: Int)
fun railViewAllAction(currentRailModel: railItemData, Type: Int)