-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSearchResultCell.swift
38 lines (30 loc) · 1.05 KB
/
SearchResultCell.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// SearchResultCell.swift
// Anibuddy
//
// Created by Kyle Grande.
//
import UIKit
// This class represents a table view cell for displaying search results
class SearchResultCell: UITableViewCell {
// Outlets for the name label, score label, and artwork image view in the cell
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var scoreLabel: UILabel!
@IBOutlet weak var artworkImageView: UIImageView!
// This method is called when the cell is loaded from the nib
override func awakeFromNib() {
super.awakeFromNib()
}
// This method is called when the cell's selected state is changed
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
// This method configures the cell with an Anime object
func configure(with anime: Anime) {
nameLabel.text = anime.title
scoreLabel.text = String(anime.score)
if let imageUrlString = anime.imageUrl, let imageUrl = URL(string: imageUrlString) {
artworkImageView.downloadImage(from: imageUrl)
}
}
}