SwifterSwift v3.1.0 Release Notes

  • API Breaking

    • String

      • firstCharacter has been renamed to firstCharacterAsString. #208 by @omaralbeik
      • lastCharacter has been renamed to lastCharacterAsString. #208 by @omaralbeik
      • firstCharacter has been renamed to firstCharacterAsString. #208 by @omaralbeik
      • float has been renamed to float(locale: Locale = .current). #208 by @omaralbeik
      • double has been renamed to double(locale: Locale = .current). #208 by @omaralbeik
      • subscript(i: Int) has been renamed to subscript(safe i: Int). #208 by @omaralbeik
      • subscript(range: CountableRange<Int>) has been renamed to subscript(safe range: CountableRange<Int>). #208 by @omaralbeik
      • subscript(range: ClosedRange<Int>) has been renamed to subscript(safe range: ClosedRange<Int>). #208 by @omaralbeik
      • replacing(_ substring: String, with newString: String) is deprecated, use Apple's replacingOccurrences(of: substring, with: newString) instead. #208 by @omaralbeik
      • int8 is deprecated, use Int8(string) instead. #208 by @omaralbeik
      • int16 is deprecated, use Int16(string) instead. #208 by @omaralbeik
      • int32 is deprecated, use Int32(string) instead. #208 by @omaralbeik
      • int64 is deprecated, use Int64(string) instead. #208 by @omaralbeik
      • float32 is deprecated, use Float32(string) instead. #208 by @omaralbeik
      • float64 is deprecated, use Float64(string) instead. #208 by @omaralbeik
    • UIColor

      • init(hex: Int, transparency: CGFloat = 1) is now a failable initializer init?. #208 by @omaralbeik
      • init(red: Int, green: Int, blue: Int, transparency: CGFloat = 1) is now a failable initializer init?. #208 by @omaralbeik
      • redComponent is deprecated, use the new rgbComponenets.red instead. #208 by @omaralbeik
      • greenComponent is deprecated, use the new rgbComponenets.green instead. #208 by @omaralbeik
      • blueComponent is deprecated, use the new rgbComponenets.blue instead. #208 by @omaralbeik

    โœจ Enhancements

    • New String extensions
      • added cgFloat(locale: Locale = .current) to get CGFloat value from string. #208 by @omaralbeik
      • added words to return an array of all words in a string. #208 by @omaralbeik
      • added wordCount to get count of words in a string. #208 by @omaralbeik
    • New Int extensions
    • New Array extensions
    • New UITextField extensions
      • added addPaddingLeftIcon(_ image: UIImage, padding: CGFloat) to add padding to the left of the textfield rect. #203 by @xingfuqiu
      • added hasValidEmail to check if textFields text is a valid email format. #208 by @omaralbeik
      • added textType to set textField for common text types like email addresses & passwords. #208 by @omaralbeik
    • New UIColor extensions
      • added rgbComponenets to get RGB components for a UIColor. #208 by @omaralbeik
    • โž• Added usage examples in documentation for Foundation extensions. #208 by @omaralbeik
    • ๐Ÿšš Moved many duplicated extensions from DoubleExtensions and FloatExtensions into the new FloatingPointExtensions, this makes the code easier to maintain and brings support for other FloatingPoint types like CGFloat, Double32, ... #208 by @omaralbeik

    ๐Ÿ›  Bugfixes

    • ๐Ÿ›  Fixed XCTAssertNotNil cannot handle optionals. #188. by @omaralbeik
    • ๐Ÿ›  Fixed Tests are failing at non-english machine / Bug in String.double #187. by @omaralbeik