NCEmpty.swift 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //
  2. // NCEmpty.swift
  3. // Nextcloud
  4. //
  5. // Created by Marino Faggiana on 19/10/2020.
  6. // Copyright © 2020 Marino Faggiana. All rights reserved.
  7. //
  8. import Foundation
  9. class NCEmpty: NSObject {
  10. var emptyView: NCEmptyView?
  11. init(collectioView: UICollectionView, image: UIImage, title: String, description: String) {
  12. super.init()
  13. if let emptyView = UINib(nibName: "NCEmptyView", bundle: nil).instantiate(withOwner: self, options: nil).first as? NCEmptyView {
  14. self.emptyView = emptyView
  15. emptyView.emptyImage.image = image
  16. emptyView.emptyTtle.text = title
  17. emptyView.emptyDescription.text = description
  18. collectioView.addSubview(emptyView)
  19. emptyView.leftAnchor.constraint(equalTo: collectioView.leftAnchor).isActive = true
  20. emptyView.rightAnchor.constraint(equalTo: collectioView.rightAnchor).isActive = true
  21. emptyView.topAnchor.constraint(equalTo: collectioView.topAnchor).isActive = true
  22. emptyView.bottomAnchor.constraint(equalTo: collectioView.bottomAnchor).isActive = true
  23. }
  24. }
  25. }
  26. class NCEmptyView: UIView {
  27. @IBOutlet weak var emptyImage: UIImageView!
  28. @IBOutlet weak var emptyTtle: UILabel!
  29. @IBOutlet weak var emptyDescription: UILabel!
  30. }