OOPersonCollectionViewCell.swift 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // OOPersonCollectionViewCell.swift
  3. // O2Platform
  4. //
  5. // Created by 刘振兴 on 2018/5/4.
  6. // Copyright © 2018年 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. class OOPersonCollectionViewCell: UICollectionViewCell,Configurable {
  10. @IBOutlet weak var iconImageView: UIImageView!
  11. @IBOutlet weak var nameLabel: UILabel!
  12. private lazy var viewModel:OOPersonListViewModel = {
  13. return OOPersonListViewModel()
  14. }()
  15. override func awakeFromNib() {
  16. super.awakeFromNib()
  17. // Initialization code
  18. }
  19. func config(withItem item: Any?) {
  20. guard let model = item as? OOPersonModel else {
  21. return
  22. }
  23. nameLabel.text = model.name
  24. viewModel.getIconOfPerson(model, compeletionBlock: { (iconImage, errMsg) in
  25. if errMsg == nil {
  26. self.iconImageView.image = iconImage
  27. }else{
  28. print(errMsg!)
  29. }
  30. })
  31. }
  32. }