UIRefreshControl+TitleAttributes.swift 534 B

123456789101112131415161718
  1. //
  2. // UIRefreshControl+TitleAttributes.swift
  3. // SwiftTheme
  4. //
  5. // Created by kcramer on 4/1/18.
  6. // Copyright © 2018 Gesen. All rights reserved.
  7. //
  8. import Foundation
  9. extension UIRefreshControl {
  10. @objc func updateTitleAttributes(_ newAttributes: [NSAttributedString.Key: Any]) {
  11. guard let title = self.attributedTitle else { return }
  12. let newString = NSAttributedString(attributedString: title,
  13. merging: newAttributes)
  14. self.attributedTitle = newString
  15. }
  16. }