diff --git a/Yep/Views/Cells/Feed/FeedURLCell.swift b/Yep/Views/Cells/Feed/FeedURLCell.swift index cb49930d..6b207fe6 100644 --- a/Yep/Views/Cells/Feed/FeedURLCell.swift +++ b/Yep/Views/Cells/Feed/FeedURLCell.swift @@ -60,16 +60,8 @@ class FeedURLCell: FeedBasicCell { if let attachment = feed.attachment { if case let .URL(URLInfo) = attachment { - feedURLContainerView.siteNameLabel.text = URLInfo.siteName - feedURLContainerView.titleLabel.text = URLInfo.title - feedURLContainerView.descriptionLabel.text = URLInfo.description - if let thumbnailImageURL = NSURL(string: URLInfo.thumbnailImageURLString) { - feedURLContainerView.thumbnailImageView.kf_setImageWithURL(thumbnailImageURL, placeholderImage: nil) - } else { - feedURLContainerView.thumbnailImageView.image = nil - feedURLContainerView.thumbnailImageView.backgroundColor = UIColor.lightGrayColor() - } + feedURLContainerView.configureWithFeedURLInfoType(URLInfo) feedURLContainerView.tapAction = { [weak self] in self?.tapURLAction?(URLInfo.URL) diff --git a/Yep/Views/ContainerViews/FeedURLContainerView.swift b/Yep/Views/ContainerViews/FeedURLContainerView.swift index 444967a3..ac64c61d 100644 --- a/Yep/Views/ContainerViews/FeedURLContainerView.swift +++ b/Yep/Views/ContainerViews/FeedURLContainerView.swift @@ -125,5 +125,19 @@ class FeedURLContainerView: UIView { @objc private func tap(sender: UITapGestureRecognizer) { tapAction?() } + + func configureWithFeedURLInfoType(URLInfo: FeedURLInfoType) { + + siteNameLabel.text = URLInfo.siteName + titleLabel.text = URLInfo.title + descriptionLabel.text = URLInfo.infoDescription + + if let thumbnailImageURL = NSURL(string: URLInfo.thumbnailImageURLString) { + thumbnailImageView.kf_setImageWithURL(thumbnailImageURL, placeholderImage: nil) + } else { + thumbnailImageView.image = nil + thumbnailImageView.backgroundColor = UIColor.lightGrayColor() + } + } } diff --git a/Yep/Views/Feed/FeedView.swift b/Yep/Views/Feed/FeedView.swift index b44d30aa..f4b552c9 100644 --- a/Yep/Views/Feed/FeedView.swift +++ b/Yep/Views/Feed/FeedView.swift @@ -353,15 +353,7 @@ class FeedView: UIView { socialWorkContainerViewHeightConstraint.constant = 80 if let URLInfo = feed.URLInfo { - feedURLContainerView.siteNameLabel.text = URLInfo.siteName - feedURLContainerView.titleLabel.text = URLInfo.title - feedURLContainerView.descriptionLabel.text = URLInfo.infoDescription - if let thumbnailImageURL = NSURL(string: URLInfo.thumbnailImageURLString) { - feedURLContainerView.thumbnailImageView.kf_setImageWithURL(thumbnailImageURL, placeholderImage: nil) - } else { - feedURLContainerView.thumbnailImageView.image = nil - feedURLContainerView.thumbnailImageView.backgroundColor = UIColor.lightGrayColor() - } + feedURLContainerView.configureWithFeedURLInfoType(URLInfo) } case .Image: