SwifterSwift v1.2.1 Release Notes

  • 🆕 New Extensions:

    • ConvenienceExtensions:

      • func string(forKey: String): Get a string from UserDefaults
      • func integer(forKey: String): Get an integer from UserDefaults
      • func double(forKey: String): Get a double from UserDefaults
      • func float(forKey: String): Get a float from UserDefaults
      • func data(forKey: String): Get a data from UserDefaults
      • func bool(forKey: String): Get a bool from UserDefaults
      • func array(forKey: String): Get an array from UserDefaults
      • func dictionary(forKey: String): Get a dictionary from UserDefaults
    • StringExtensions:

      • func toDate(withFormat format: String): Return Date value from string of date format (if applicable).
      • var toURL: Return URL from string (if applicable).
    • UIAlertControllerExtensions:

      • addAction(title, style, isEnabled, handler): Add an action to Alert.
      • addTextField(text, placeholder, editingChangedTarget, editingChangedSelector): Add a text field to Alert.
    • UINavigationBarExtensions:

      • func setColors(background, text): Set Navigation Bar background and text colors.

    ⚡️ Updated Extensions:

    • ConvenienceExtensions:

      • var deviceHeight -> var screenHeight
      • var deviceWidth -> var screenWidth
    • ArrayExtensions:

      • func removeAll(item: Element) -> func removeAll(_ item: Element))
    • DateExtensions:

      • func add(component: Calendar.Component, value: Int) -> add(_ component: Calendar.Component, value: Int)
      • func adding(component: Calendar.Component, value: Int) -> adding(_ component: Calendar.Component, value: Int)
      • func changing(component: Calendar.Component, value: Int) -> changing(_ component: Calendar.Component, value: Int)
      • func isIn(current: Calendar.Component) -> isInCurrent(_ component: Calendar.Component)
    • StringExtensions:

      • func contain(string: String, caseSensitive: Bool) -> func contain(_ string: String, caseSensitive: Bool)
      • func lines() -> var lines
      • static func random(of length: Int) -> static func random(ofLength: Int)
      • func replace(string: String, with: String) -> func replace(_ substring: String, with: String)
      • func truncate(to length: Int, trailing: String?) -> func truncate(toLength: Int, trailing: String?)
      • func truncated(to length: Int, trailing: String? = "...") -> func truncated(to length: Int, trailing: String?)
    • UIButtonExtensions:

      • func imageForAllStates(image: UIImage) -> func setImageForAllStates(_ image: UIImage)
      • func titleColorForAllStates(color: UIColor) -> func setTitleColorForAllStates(_ color: UIColor)
      • func titleForAllStates(title: String) -> func setTitleForAllStates(_ title: String)
    • UIColorExtensions:

      • init(netHex:Int) -> init(hex:Int, transparency: CGFloat = 1)
    • UIImageExtensions:

      • func scaledToHeight(height: CGFloat, with orientation: UIImageOrientation?) -> scaled(toHeight: CGFloat, with orientation: UIImageOrientation?)
      • func scaledToWidth(width: CGFloat, with orientation: UIImageOrientation?) -> scaled(toWidth: CGFloat, with orientation: UIImageOrientation?)
    • UIImageViewExtensions:

      • func download(fromUrl: String?, contentMode: UIViewContentMode, placeHolder: UIImage?)) -> download(from: URL?, contentMode: UIViewContentMode, placeHolder: UIImage?, completionHandler: ((UIImage?, Error?) -> Void)?)
    • UISliderExtensions:

      • func setValue(value: Float, animated: Bool, duration: TimeInterval, completion: (() -> Void)? = nil) -> func setValue(_ value: Float, animated: Bool, duration: TimeInterval, completion: (() -> Void)?)
    • UITableViewExtensions:

      • var totalRows -> var numberOfRows
    • UITextFieldExtensions:

      • func setPlaceHolderTextColor(color: UIColor) -> func setPlaceHolderTextColor(_ color: UIColor)
    • UIViewExtensions:

      • func loadFromNibNamed(nibNamed: String, bundle : Bundle?) -> func loadFromNib(named: String, bundle : Bundle?)

    ✂ Removed Extensions:

    • StringExtensions:
      • var locale