SwifterSwift v4.5.0 Release Notes
Release Date: 2018-09-21 // over 5 years ago-
โ Added
- CGVector
- Added
angle
computed property to get the angle of the vector (in radians). #527 by moyerr - Added
magnitude
computed property to get the magnitude (or length) of the vector. #527 by moyerr - Added scalar multiplication of CGFloat and CGVector via standard multiplication operator (*). #527 by moyerr
- Added negation of vectors via prefix (-) operator. #527 by moyerr
- Added
init(angle:magnitude:)
to create vectors based on their angle and magnitude. #527 by moyerr -UIRefreshControl: beginRefresh(in tableView:, animated:, sendAction:)
UIRefreshControl extension to begin refresh programatically. #525 by ratulSharker
- Added
- Dictionary:
- Added
removeValueForRandomKey()
to remove a value for a random key from a dictionary. #497 by MaxHaertwig. - Added
mapKeysAndValues(_:)
to map aDictionary
into aDictionary
with different (or same)Key
andValue
types. #546 by guykogus - Added
compactMapKeysAndValues(_:)
to map aDictionary
into aDictionary
, excludingnil
results, with different (or same)Key
andValue
types. #546 by guykogus - Added
keys(forValue:)
which returns an array of all keys that have the given value in dictionary. #561 by mauliksharma.
- Added
- RangeReplaceableCollection:
- Added
removeRandomElement()
to remove a random element from a collection. #497 by MaxHaertwig.
- Added
- UIView
- Added
addGestureRecognizers(_:)
which accepts an array ofUIGestureRecognizer
to add multiple gesture recognizers to a view with one call. #523 by moyerr - Added
removeGestureRecognizers(_:)
which accepts an array ofUIGestureRecognizer
to remove multiple gesture recognizers from a view with one call. #523 by moyerr
- Added
- UIViewController
- Added
addChildViewController(_:toContainerView)
to easily add child view controllers. Accepts aUIViewController
and aUIView
to add the child's view to. - Added
removeViewAndControllerFromParentViewController()
to remove aUIViewController
from its parent.
- Added
- NSView
- Added
backgroundColor
which allows to change backgroundColor of NSView #702 by RomanPodymov
- Added
- UIEdgeInsets
- Added
insetBy(top:)
,insetBy(left:)
,insetBy(bottom:)
,insetBy(right:)
,insetBy(horizontal:)
andinsetBy(vertical:)
to creates anUIEdgeInsets
based on current value and adjusted by given offset. #532 by VincentSit. - Added operators
+
and+=
to add two insets together in order to extend them. #557 by guykogus
- Added
- UILayoutPriority
- Added
init(floatLiteral value: Float)
initializer to initialize priority with float literal. #549 by diamantidis. - Added
init(integerLiteral value: Int)
initializer to initialize priority with integer literal. #549 by diamantidis.
- Added
- RangeReplaceableCollection
init(expression:count:)
to create a collection of a given count initialized with an expression.#537 by LucianoPAlmeida.
- Optional:
- Data:
- URL
- CGSize
- Added operator
+
to return the addition of two CGSize. - Added operator
+=
to add a CGSize to another. - Added operator
-
to return the subtraction of two CGSize. - Added operator
-=
to subtract a CGSize from another. - Added operator
CGSize * CGSize
to return the multiplication of two CGSize. - Added operator
CGSize * CGFloat
andCGFloat * CGSize
to return the multiplication of a CGSize and a CGFloat value. - Added operator
CGSize *= CGSize
to multiply a CGSize with another one. - Added operator
CGSize *= CGFloat
to multiply a CGSize with a CGFloat value.
- Added operator
- UIImage:
๐ Changed
- RangeReplaceableCollection:
rotate(by:)
androtated(by:)
array extensions now are more genericRangeReplaceableCollection
extensions. #512 by LucianoPAlmeida.removeFirst(where:)
array extension now is more genericRangeReplaceableCollection
extensions. #516 by LucianoPAlmeida.
- RandomAccessCollection:
indices(of:)
array extension now is more genericRandomAccessCollection
extensions. #516 by LucianoPAlmeida.
- UIView:
๐ Fixed
- UIImage:
- ๐ Fixed
scaled(toWidth:, with orientation:)
andscaled(toHeight:, with orientation:)
were using image's scale as the scale factor. #515 by VincentSit. - String:
- Used RFC 5322 in
isValidEmail
, an email address regex that 99.99% works. #517 by Omar Albeik - Fixed
unicodeArray()
not returning the correct unicode value due to Swift 4.2 new hashing system. #544 by Omar Albeik
- Used RFC 5322 in
๐ Deprecated
- String:
isEmail
property has been renamed toisValidEmail
.
โ Removed
๐ Security
- CGVector