add episode detail vc transition to search
MODIFY
Podcast/DiscoverViewController.swift
Podcast/DiscoverViewController.swift
@@ -244,4 +244,10 @@ class DiscoverViewController: UIViewController, UITableViewDelegate, UITableView
tagViewController.tag = tag
navigationController?.pushViewController(tagViewController, animated: true)
}
+
+ func didTapOnEpisodeCell(episode: Episode) {
+ let episodeViewController = EpisodeDetailViewController()
+ episodeViewController.episode = episode
+ navigationController?.pushViewController(episodeViewController, animated: true)
+ }
}

MODIFY
Podcast/EpisodeDetailHeaderView.swift
Podcast/EpisodeDetailHeaderView.swift
@@ -84,8 +84,21 @@ class EpisodeDetailHeaderView: UIView {
func setupForEpisode(episode: Episode) {
// TODO: load from URL
episodeArtworkImageView.image = #imageLiteral(resourceName: "filler_image")
+ if let url = episode.smallArtworkImageURL {
+ if let data = try? Data(contentsOf: url) {
+ episodeArtworkImageView.image = UIImage(data: data)
+ }
+ }
+
+ if episode.seriesTitle != "" {
+ seriesTitleLabel.text = "Wait Wait Don't Tell Me"
+ } else {
seriesTitleLabel.text = episode.seriesTitle
- publisherLabel.text = "Publisher >"
+ }
+
+ // TODO: implement publishers
+ publisherLabel.text = "NPR >"
+
episodeTitleLabel.text = episode.title
episodeTitleLabel.sizeToFit()
dateLabel.text = episode.dateTimeSeriesString()

MODIFY
Podcast/TabbedPageViewController.swift
Podcast/TabbedPageViewController.swift
@@ -19,6 +19,7 @@ protocol TabbedPageViewControllerScrollDelegate: class {
protocol TabbedViewControllerSearchResultsControllerDelegate: class {
func didTapOnSeriesCell(series: Series)
func didTapOnTagCell(tag: Tag)
+ func didTapOnEpisodeCell(episode: Episode)
}
class TabbedPageViewController: UIViewController, UIPageViewControllerDataSource, UIPageViewControllerDelegate, UISearchResultsUpdating, TabBarDelegate, SearchTableViewControllerDelegate, UINavigationControllerDelegate {
@@ -260,9 +261,8 @@ class TabbedPageViewController: UIViewController, UIPageViewControllerDataSource
//add new views here
switch(searchType) {
case .episodes:
- //present episode detail view here
- let dummyViewController = UIViewController()
- presentingViewController?.navigationController?.pushViewController(dummyViewController, animated: true)
+ guard let episode = searchResults[.episodes]?[index] as? Episode else { return }
+ searchResultsDelegate?.didTapOnEpisodeCell(episode: episode)
case .series:
guard let series = searchResults[.series]?[index] as? Series else { return }
searchResultsDelegate?.didTapOnSeriesCell(series: series)

add episode detail vc transition to search