SwifterSwift v5.1.0 Release Notes

Release Date: 2019-09-23 // over 4 years ago
  • โž• Added

    • Array:

      • Added withoutDuplicates(keyPath:) for filtering duplicate elements based on key path. #704 by RomanPodymov.
    • Sequence:

      • Added withoutDuplicates(transform:) for remove duplicate elements based on condition in a sequence. #666 by saucym
      • Added sorted(by:with:) to return sorted array from a Sequence with by a given keyPath using a compare function. #712 by LucianoPAlmeida
    • MutableCollection:

      • Added sort(by:with:) to sort a Collection with by a given keyPath using a compare function. #712 by LucianoPAlmeida
    • String

      • isPalindrome computed property of String to check if it is a palindrome. #671 by cHaLkdusT.
    • CGSize:

      • Added aspectRatio, maxDimension, and minDimension properties. #662 by MaxHaertwig.
    • SCNBox:

      • Added init(width:height:length:), init(sideLength:chamferRadius:), init(width:height:length:chamferRadius:material:), init(sideLength:chamferRadius:material:), init(width:height:length:chamferRadius:color:), and init(sideLength:chamferRadius:color:) convenience initializers. #660 by MaxHaertwig.
    • SCNCapsule:

      • Added init(capDiameter:height), init(capRadius:height:material:), init(capDiameter:height:material:), init(capRadius:height:color:), and init(capDiameter:height:color:) convenience initializers. #660 by MaxHaertwig.
    • SCNCone:

      • Added init(topDiameter:bottomDiameter:height), init(topRadius:bottomRadius:height:material:), init(topDiameter:bottomDiameter:height:material:), init(topRadius:bottomRadius:height:color:), and init(topDiameter:bottomDiameter:height:color:) convenience initializers. #660 by MaxHaertwig.
    • SCNCylinder:

      • Added init(diameter:height), init(radius:height:material:), init(diameter:height:material:), init(radius:height:color:), and init(diameter:height:color:) convenience initializers. #660 by MaxHaertwig
    • SCNGeometry:

      • Added boundingSize property to get the size of the geometry's bounding box. #660 by MaxHaertwig.
    • SCNMaterial:

    • SCNPlane:

      • Added init(width:), init(width:height:material:), init(width:material:), init(width:height:color:), and init(width:color:) convenience initializers. #660 by MaxHaertwig.
    • SCNShape:

      • Added init(path:extrusionDepth:material:) and init(path:extrusionDepth:color:) convenience initializers. #660 by MaxHaertwig.
    • SCNSphere:

      • Added init(diameter:), init(radius:material:), init(radius:color:), init(diameter:material:), and init(diameter:color:) convenience initializers. #660 by MaxHaertwig.
    • SCNVector3:

      • Added absolute property to calculate the vector's components as absolute values. #660 by MaxHaertwig.
      • Added length property to calculate the vector's length. #660 by MaxHaertwig.
    • UICollectionView:

      • Added isValidIndexPath(_:) method to check whether given IndexPath is valid within UICollectionView. #695 by emilrb.
      • Added safeScrollToItem(at:at:animated:) method to safely scroll UICollectionView to the given IndexPath. #698 by emilrb
    • Sequence:

      • Moved divided(by:) ArrayExtensions to SequenceExtensions. This function separates all items into 2 lists based on a given predicate. #706 by cHaLkdusT
    • UIBezierPath:

      • Added init(from:to:), init(points:), init(polygonWithPoints:), init(ovalOf:centered:) and init(rectOf:centered:) convenience initializers. #659 by MaxHaertwig.

    ๐Ÿ”„ Changed

    • UIApplication:

    • Sequence:

    ๐Ÿ—„ Deprecated

    • Array:
      • Deprecated sorted(by:, ascending) and sort(by:ascending) in favor of sorted(by:with:) and sort(by:with:) #712 by LucianoPAlmeida

    โœ‚ Removed

    • Character:

      • Removed isNumber, isLetter, isLowercased, isUppercased and isWhiteSpace because the same properties are defined in the Swift standard library. #689 by RomanPodymov.
    • Array:

      • Removed divided(by:) function from ArrayExtensions #706 by cHaLkdusT

    ๐Ÿ›  Fixed

    • UIApplication:

      • Resolved an issue where version would return the wrong Info.plist value.
      • Resolved an issue where version and displayName would return nil if localized.
    • UIImage:

      • The size of rect can equal to the size of UIImage when using cropped(to:) to crop UIImage. #679 by dirtmelon.
      • scaled(toHeight:opaque:) and scaled(toWidth:opaque:) will now keep the original scale of UIImage. #703 by ShannonChou
    • UITableView:

      • isValidIndexPath(_:) will now return false for IndexPaths with a negative row or section. #696 by emilrb.