SwifterSwift v5.1.0 Release Notes

Release Date: 2019-09-23 // 4 months 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.


Previous changes from v5.0.0

  • ➕ Added

    • 👍 Swift 5.0 Support
      • Updated the project to Xcode 10.2
      • Removed unnecessary public statements.
    • 🐧 Linux Support
      • Support for Linux running Swift 5.0 using Swift Package Manager.
    • UIApplication:
      • Added inferredEnvironment to get current inferred app environment. by omaralbeik
      • Added displayName to get application name. by omaralbeik
      • Added buildNumber to get application build number. by omaralbeik
      • Added version to get application version number. by omaralbeik
    • Optional:
      • Added nonEmpty to get the collection only if it is not nill and not empty. by omaralbeik
    • FileManager:
      • Added createTemporaryDirectory() to create a directory for saving temporary files. #615 by guykogus
    • UILabel:
      • Added init(text:style) to create a UILabel with a text and font style. #607 by marcocapano
    • UIViewController
      • Added presentPopover(_:sourcePoint:size:delegate:animated:completion:) method to quickly present a UIViewController as a popover. #593 by marcocapano
    • Sequence:
      • Added duplicates() for getting the duplicated elements in a sequence. #605 by dylancfe15
    • Date:
    • ➕ Added tomorrow computed property to get tomorrow's date avoiding calling adding(_:value:) function. (Completes PR #578) #587 by AlexeiGitH
      • Added random(in:) and random(in:using:) to generate random dates using the built-in random functions added to Swift 4.2. #576 by guykogus
    • Dictionary:
      • Added Dictionary[path:] subscript for deep fetching/setting nested values. #574 by @calebkleveter
    • UIColor:
    • DispatchQueue:
      • Added isMainQueue to check if current queue is main queue. #585 by jianstm
      • Added isCurrent(_:) to check if current queue is specified queue. #585 by jianstm
    • BidirectionalCollection:
      • Added subscript[offset:] to get element with negative offset. #582 by jianstm
    • BinaryFloatingPointExtensions:
      • Added rounded(numberOfDecimalPlaces:rule:) to get the rounded floating number with the specified number of decimal places. #583 by jianstm
    • UIActivity:
      • Added ActivityType constants for iCloud Drive, WhatsApp, LinkedIn and XING. #580 by staffler-xyz
    • MKMapView
      • Added 'register(annotationViewWithClass:),dequeueReusableAnnotationView(withClass:)anddequeueReusableAnnotationView(withClass:annotation)` methods. #629 by staffler-xyz

    🔄 Changed

    • Character:
    • String:
      • Added more cases to isEmoji. by omaralbeik
      • Made camelize, latinize, reverse, slice, trim, truncate, urlDecode, urlEncode, padStart, and padEnd return a discardableResult self. by omaralbeik
    • Examples:
      • Replaced Examples.md with Examples.playground to let users try some examples out of extensions. #596 by maxxx777
    • StringProtocol:
      • Removing Index constraint on commonSuffix extension and improving performance and tests. #606 by LucianoPAlmeida.
    • RangeReplaceableCollection:
      • Array extensions keep(while: ), take(while: ) and skip(while:) are now RangeReplaceableCollection extensions. #634 by LucianoPAlmeida.
    • Date:
      • Fixed yesterday computed property to be calculated using Calendar.date(byAdding:to:) instead of date.addingTimeInterval(-86400) #641 by AlexeiGitH.

    🛠 Fixed

    • UIImageView:
      • Fixed download function to use unowned self. by omaralbeik
    • Installation:
      • Updated podspec to make the group paths in Pods project of SwifterSwift correct with Cocoapods installation. #590 by dklinzh
    • UIImage:
    • NSAttributedString:
    • Date:
      • Fixed yesterday computed property to be calculated using Calendar.date(byAdding:to:) instead of date.addingTimeInterval(-86400) #641 by AlexeiGitH.
      • Fixed tomorrow computed property to be calculated using Calendar.date(byAdding:to:) instead of date.addingTimeInterval(86400) #642 by AlexeiGitH.

    ✂ Removed

    • SwifterSwift:
      • Breaking Change Removed SwifterSwift by omaralbeik.
    • Collection:
      • Removed firstIndex(where: ), firstIndex(of:), lastIndex(where: ), lastIndex(of:) which are no longer needed. #637 by marcocapano
    • Date:
      • Removed random(from:upTo:) in favor of random(in:) and random(in:using:). #576 by guykogus
      • Removed timeZone should never have been added because Dates are timezone-agnostic. This came to my attention during unit testing over daylight savings changes. #594 by guykogus

    CI

    • ⚡️ Updated Travis to use the new xcode10.2 osx_image.
    • ➕ Added Fastlane to automate the releasing process for maintainers.