Using the example from TwitterKit from Fabric for iOS (in Swift 3.0) I get the query that I am looking for, but the format is only showing a url link to the Periscope video (See sample image below). Same thing happens if I try Vine. I was expecting to see the video like I do in the Twitter app instead of just the url. How do I get the video (or live feed if it is live) instead of just the url?
import UIKit
import TwitterKit
class TwitterViewController: TWTRTimelineViewController {
// MARK: Properties
let searchQuery = "rowing filter:periscope"
override func viewDidLoad() {
super.viewDidLoad()
let client = TWTRAPIClient()
self.dataSource = TWTRSearchTimelineDataSource(searchQuery: self.searchQuery, apiClient: client)
self.showTweetActions = true
// Customize the table view.
let headerHeight: CGFloat = 25
tableView.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: tableView.bounds.size.width, height: headerHeight))
tableView.tableFooterView = UIView()
tableView.backgroundColor = UIColor.lightGray
// Customize the navigation bar.
title = "Tweets"
navigationController?.navigationBar.isTranslucent = true
// Add an initial offset to the table view to show the animated refresh control.
let refreshControlOffset = refreshControl?.frame.size.height
tableView.frame.origin.y += refreshControlOffset!
refreshControl?.tintColor = UIColor.blue
refreshControl?.beginRefreshing()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
// Make sure the navigation bar is not translucent when scrolling the table view.
navigationController?.navigationBar.isTranslucent = false
// Display a label on the background if there are no recent Tweets to display.
let noTweetsLabel = UILabel()
noTweetsLabel.text = "Sorry, there are no more recent Tweets to display."
noTweetsLabel.textAlignment = .center
noTweetsLabel.textColor = UIColor.blue
noTweetsLabel.font = UIFont(name: "HelveticaNeue", size: CGFloat(14))
tableView.backgroundView = noTweetsLabel
tableView.backgroundView?.isHidden = true
tableView.backgroundView?.alpha = 0
toggleNoTweetsLabel()
}
// MARK: Utilities
fileprivate func toggleNoTweetsLabel() {
if tableView.numberOfRows(inSection: 0) == 0 {
UIView.animate(withDuration: 0.15, animations: {
self.tableView.backgroundView!.isHidden = false
self.tableView.backgroundView!.alpha = 1
})
} else {
UIView.animate(withDuration: 0.15,
animations: {
self.tableView.backgroundView!.alpha = 0
},
completion: { finished in
self.tableView.backgroundView!.isHidden = true
}
)
}
}
}