下記のコードでアンラップしろとなったのですが、これはどうやってアンラップすればよろしいのでしょうか?
import UIKit import FirebaseDatabase class HomeTableViewCell: UITableViewCell { @IBOutlet weak var profileImageView: UIImageView! @IBOutlet weak var nameLabel: UILabel! @IBOutlet weak var postImageView: UIImageView! @IBOutlet weak var likeImageView: UIImageView! @IBOutlet weak var commentImageView: UIImageView! @IBOutlet weak var shareImageView: UIImageView! @IBOutlet weak var likeCountButton: UIButton! @IBOutlet weak var captionLabel: UILabel! @IBOutlet weak var activityIndicatorView: UIActivityIndicatorView! var post: Post? { didSet { updateView() } } var user: User? { didSet { setupUserInfo() } } func updateView(){ captionLabel.text = post!.caption if let photoUrlString = post!.photoUrl { let photoUrl = URL(string: photoUrlString) postImageView.sd_setImage(with: photoUrl) } // setupUserInfo() } func setupUserInfo() { nameLabel.text = user?.username if let photoUrlString = user?.profileImageUrl { let photoUrl = URL(string: photoUrlString) profileImageView.sd_setImage(with: photoUrl, placeholderImage: UIImage(named: "placeholderImg")) } } override func awakeFromNib() { super.awakeFromNib() // Initialization code if let _ = UILabel.self { ここ!! nameLabel.text = "" captionLabel.text = "" } else { } } override func prepareForReuse() { super.prepareForReuse() profileImageView.image = UIImage(named: "placeholderImg") } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } }
そもそも、`UILabel.self`というコードはどのような意図で書いたのですか?
回答1件
あなたの回答
tips
プレビュー