Skip to content

Instantly share code, notes, and snippets.

@KaneCheshire
Created October 27, 2017 12:32
Show Gist options
  • Save KaneCheshire/b0c4c1fbd4def32a5e1c082c12438686 to your computer and use it in GitHub Desktop.
Save KaneCheshire/b0c4c1fbd4def32a5e1c082c12438686 to your computer and use it in GitHub Desktop.
final class Cell: UICollectionViewCell {
@IBOutlet private var titleLabel: UILabel!
@IBOutlet private var subtitleLabel: UILabel!
@IBOutlet private var actionLabel: UILabel!
func configure(with viewModel: CellViewModel) {
// Populate labels with the view model like always
self.titleLabel.text = viewModel.titleString
self.subtitleLabel.text = viewModel.subtitleString
self.actionLabel.text = viewModel.actionString
// Call the function in the UIView extension which knows
// how to use models that conform to `AccessibilityModel`
updateAccessibility(with: viewModel)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment