SwifterSwift v4.1.0 Release Notes

Release Date: 2017-11-16 // over 6 years ago
  • API Breaking

    • String
      • length is deprecated, use native count instead.
      • slicing(i:) is deprecated, use string[safe: i] instead.
      • slicing(from: to:) is deprecated, use string[safe: start..<end].
      • firstIndex(of:) is deprecated, use the natives index(of: Character) or range(of: StringProtocol) instead.
      • splitted(by:) is deprecated, use the native split(separator: ) instead.
      • reversed() -> String is deprecated, use the Swift 4 new reversed() -> ReversedCollection<String>. #305 by LucianoPAlmeida.
    • Date
      • weekday is now a get-only property.
      • isInThisWeek has been renamed to isInCurrentWeek.
      • isInThisMonth has been renamed to isInCurrentMonth.
      • isInThisYear has been renamed to isInCurrentYear.
      • isInWeekday has been renamed to isWorkday. #313 by kaphacius.

    ✨ Enhancements

    • New String extensions
      • added padStart(length: with:) and padEnd(length: with:) to pad the string to a length on the start or end.
      • added paddingStart(length: with:) and paddingEnd(length: with:) to return a padding string to a length on the start or end. #300 by LucianoPAlmeida
    • New NSImage extensions
      • added scaled(toMaxSize:) to scale image to maximum size with respect to aspect ratio #291 by buddax2.
    • New Date extensions
      • added isWithin(_ value: , _ component: , of date:) method to check if date is within a number of date components of another date. 295 by kaphacius.
    • New Optional extensions
      • added optional assignment operator ??= #296 by buddax2.
    • New Calendar extensions
    • New Color tests
      • added tests for cgFloatComponents. #297 by stupergenius.
      • added lighten(by percentage:) and darken(by percentage:) methods to change the hue of a color. #325 by oettingerj.
    • New CGColor tests
      • added tests for uiColor and nsColor. #281 by c1phr
    • New Date tests
    • ⚡️ Updated Travis image to Xcode 9.1. #314 by kaphacius
    • ✂ Removed cross references from extensions. #297 by stupergenius.
    • Updated copyright headers to Copyright © 2017 SwifterSwift everywhere. #308 by camdeardorff.

    🛠 Bugfixes

    • Date
      • complete rewrite for most extensions. #309 by [omaralbeik](https:github.com/omaralbeik)
      • fixed a bug in year where setting year was resetting all smaller components to zero.
      • fixed a bug in month where setting month was resetting all smaller components to zero.
      • fixed a bug in day where setting day was resetting all smaller components to zero.
      • fixed a bug in hour where setting hour was resetting all smaller components to zero.
      • fixed a bug in minute where setting minute was resetting all smaller components to zero.
      • fixed a bug in second where setting second was resetting all smaller components to zero.
      • added validation to setters for properties above.
      • fixed the above bugs in changing method as well.
      • fixed a bug where quarter was returning 1 always.
      • Added more tests to edge cases.