TableViewCellDesignable.swift 723 B

123456789101112131415161718192021222324252627
  1. //
  2. // Created by Jake Lin on 12/19/15.
  3. // Copyright © 2015 IBAnimatable. All rights reserved.
  4. //
  5. import UIKit
  6. public protocol TableViewCellDesignable: class {
  7. var removeSeparatorMargins: Bool { get set }
  8. }
  9. public extension TableViewCellDesignable where Self: UITableViewCell {
  10. func configureSeparatorMargins() {
  11. if removeSeparatorMargins {
  12. if responds(to: #selector(setter: UITableViewCell.separatorInset)) {
  13. separatorInset = .zero
  14. }
  15. if responds(to: #selector(setter: UIView.preservesSuperviewLayoutMargins)) {
  16. preservesSuperviewLayoutMargins = false
  17. }
  18. if responds(to: #selector(setter: UIView.layoutMargins)) {
  19. layoutMargins = .zero
  20. }
  21. }
  22. }
  23. }