SwifterSwift v5.2.0 Release Notes
Release Date: 2020-04-05 // almost 5 years ago-
โ Added
- CATransform3D:
identity
,isIdentity
,init(translationX:y:z:)
,init(scaleX:y:z:)
,init(rotationAngle:x:y:z:)
,translatedBy(x:y:z:)
,scaledBy(x:y:z:)
,rotated(by:x:y:z:)
,inverted()
,concatenating(_:)
,translateBy(x:y:z:)
,scaleBy(x:y:z:)
,rotate(by:x:y:z:)
,invert()
,concatenate(_:)
,isAffine
andaffineTransform()
. Also conforms toCodable
andEquatable
. #819 by guykogus
- CGAffineTransform:
- NotificationCenter:
- Optional:
- CoreLocation:
- Added
Array where Element: CLLocation extension
and addeddistance(unitLength:)
function. #799 by trevorphillips
- Added
- Decodable:
- Added
init?(data:decoder:)
to decodeDecodable
(Codable) type models. #797 by Mustafa GUNES.
- Added
- CLVisit:
- Created
CLVisit Extension
and addedlocation
property. #792 by trevorphillips
- Created
- EdgeInsets:
- Array:
- Added
sorted(like:keyPath:)
to sort an array like another array based on a key path. #772 by MaxHaertwig.
- Added
- MKMapView:
- Added
zoom(to:meter:edgePadding:animated:)
method to zoom multipleMKMapView
coordinates. #723 by Mustafa GUNES.
- Added
- Dictionary:
- RangeReplaceableCollection:
- Added
removeDuplicates(keyPath:)
for removing duplicate elements based on key path. #737 by Ilya Glushchuk. - Added
appendIfNonNil(_:)
andappendIfNonNil(contentsOf:)
methods that can append optional elements and sequences. #966 by jevonmao
- Added
- Color:
- Added
init(light:dark:)
to create an NSColor/UIColor with different variations for light and dark mode. Only available in iOS/tvOS 13.0, macOS 10.15. #722 by MaxHaertwig.
- Added
- String:
- NSRegularExpression:
- Added
enumerateMatches(in:options:range:using:)
,matches(in:options:range:)
,numberOfMatches(in:options:range:)
,firstMatch(in:options:range:)
,rangeOfFirstMatch(in:options:range:)
,stringByReplacingMatches(in:options:range:withTemplate:)
,replaceMatches(in:options:range:withTemplate:)
, which useString
andString.Range
in place ofNSString
andNSRange
to make the calls Swifter. #727 by guykogus.
- Added
- UIBarButtonItem:
- Added
flexibleSpace
andfixedSpace(width:)
extensions to UIBarButtonItem to simplify the creation of spacers. #728 by MaxHaertwig.
- Added
- UIImage:
- Added missing test for
compressedData(quality:)
. #786 by thisIsTheFoxe - Added
withBackgroundColor(_:)
to specify a background color for a partially transparent image. #721 by MaxHaertwig. - Added
init?(base64String:)
to create aUIImage
from a base-64String
. #741 by @thisIsTheFoxe - Added
pngBase64String()
,jpegBase64String(compressionQuality:)
which return a Base 64String
representation of theUIImage
s PNG or JPEG data. #747 by Moritz Sternemann. - Added
init?(url:scale:)
to initialize aUIImage
with a given url and scale factor. #753 by mmdock
- Added missing test for
- CAGradientLayer:
- Added
init(colors:locations:startPoint:endPoint:type:)
convenience initializer. #726 by JayMehta97.
- Added
- Sequence:
- Added
sum(for:)
to sum up anAdditiveArithmetic
property, referenced byKeyPath
, of all elements in a sequence. #736 by Moritz Sternemann. - Added
sorted(by:and:)
andsorted(by:and:and:)
to obtain a sorted sequence based on multiple key paths. #796 by MaxHaertwig. - Added
map(by:)
to map the sequence elements by a given key path. #763 by Roman Podymov. - Added
compactMap(by:)
to map the sequence elements by a given key path to the non-nil elements array. #766 by Roman Podymov. - Added
filter(by:)
to filter the sequence elements by a given boolean key path. #771 by Roman Podymov.
- Added
- MutableCollection:
- Added
assignToAll(value:keyPath:)
to assign given value to fieldkeyPath
of every element in the collection. #759 by cyber-gh. - Added
sort(by:and:)
andsort(by:and:and:)
to sort a sequence based on multiple key paths. #796 by MaxHaertwig.
- Added
- KeyedDecodingContainer:
- Locale:
- URLRequest:
- SKProduct:
- Added
localizedPrice
to get localized price of product. #781 by strawb3rryx7.
- Added
- CGRect
- Added property
center
. #814 by qchenqizhi. - Added initializer
init(center:size:)
to createCGRect
with center and size. #814 by qchenqizhi. - Added
resizing(to:anchor:)
to createCGRect
by resizing with anchor. #814 by qchenqizhi.
- Added property
๐ Changed
- Collection:
- UIImage:
- UIImage:
- Sequence:
- NSAttributedString:
- Update
applying(attributes: [NSAttributedString.Key : Any], toRangesMatching pattern: String)
to respondapplying(attributes: [NSAttributedString.Key : Any], toRangesMatching pattern: String, options: NSRegularExpression.Options = [])
signature to support regular expression options. #791 by DimaZava
- Update
- UIButton:
- Refactored
centerTextAndImage(spacing:)
: now the image position can be above the text, by setting a new parameterimageAboveText
totrue
. #807 by qchenqizhi.
- Refactored
- String:
๐ Fixed
- ๐ Fixed build error occurring when building AppKit extensions for macCatalyst. #762 by MaxHaertwig.
- ๐ Fixed
String.base64Decoded
making it a safe decode by including padding on the string. #801 by LucianoPAlmeida. - ๐ Fixed
UIImage.cropped(to:)
making it work correctly with scaled image. #811 by qchenqizhi.
- CATransform3D: