Changelog History
Page 2
-
v4.1.0 Changes
November 16, 2017API Breaking
- String
length
is deprecated, use nativecount
instead.slicing(i:)
is deprecated, usestring[safe: i]
instead.slicing(from: to:)
is deprecated, usestring[safe: start..<end]
.firstIndex(of:)
is deprecated, use the nativesindex(of: Character)
orrange(of: StringProtocol)
instead.splitted(by:)
is deprecated, use the nativesplit(separator: )
instead.reversed() -> String
is deprecated, use the Swift 4 newreversed() -> ReversedCollection<String>
. #305 by LucianoPAlmeida.
- Date
✨ Enhancements
- New String extensions
- added
padStart(length: with:)
andpadEnd(length: with:)
to pad the string to a length on the start or end. - added
paddingStart(length: with:)
andpaddingEnd(length: with:)
to return a padding string to a length on the start or end. #300 by LucianoPAlmeida
- added
- New NSImage extensions
- New Date extensions
- New Optional extensions
- New Calendar extensions
- added
numberOfDaysInMonth
to get number of days in the month for a specified date. #311 by chaithanyaprathyush.
- added
- New Color tests
- added tests for
cgFloatComponents
. #297 by stupergenius. - added
lighten(by percentage:)
anddarken(by percentage:)
methods to change the hue of a color. #325 by oettingerj.
- added tests for
- New CGColor tests
- 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.
- String
-
v4.0.1 Changes
October 08, 2017API Breaking
N/A
✨ Enhancements
- Color
- Refactored duplicated code from
UIColorExtensions
andNSColorExtensions
intoColorExtensions
. thanks to SD10. - Refactored duplicated tests from
UIColorExtensionsTests
andNSColorExtensionsTests
intoColorExtensionsTests
. #260 by LeLuckyVint. - Add
cgFloatComponents
to get RGB components for a Color represented as CGFloat numbers (between 0 and 1) blend
now support NSColor as well.- Corrected some typos in README. #263 by nick3399.
- Refactored duplicated code from
- New String extensions
- Add
localized(comment:)
to returns a localized string, with an optional comment for translators. #269 by MaxHaertwig.
- Add
- New NSPredicate extensions
- Add
not
to returns a new predicate formed by NOT-ing the predicate. - Add
and(_ predicate: NSPredicate)
to returns a new predicate formed by AND-ing the argument to the predicate. - Add
or(_ predicate: NSPredicate)
to returns a new predicate formed by OR-ing the argument to the predicate. #273 by MaxHaertwig.
- Add
- New UILabel extensions
- Add
convenience init(text: String?)
to initialize a UILabel with text. #271 by MaxHaertwig.
- Add
- New Bool extensions
- Add
random
to returns a random boolean value. #272 by MaxHaertwig.
- Add
- Continuous Integration
- Add macOS tests to travis-ci.
- Add calls to
swiftlint
andpod lib lint
in Travis #264 by calebkleveter.
- New SignedNumeric extensions tests ### 🛠 Bugfixes
- Color
- Fixed a bug in
rgbComponents
,shortHexString
, andshortHexOrHexString
where an exception was raised when color is white or black. - Corrected a typo in
rgbComponenets
->rgbComponents
- Fixed a bug in
- Color
-
v4.0.0 Changes
September 27, 2017API Breaking
- Swift4 / Xcode9 🎉
- This version brings support for Swift4 and Xcode9. Looking for Swift3 / 3.2 ?
- UIColor
social
has been renamed toSocial
to match Apple Swift guidelinesmaterial
has been renamed toMaterial
to match Apple Swift guidelinesflatUI
has been renamed toFlatUI
to match Apple Swift guidelinescss
has been renamed toCSS
to match Apple Swift guidelines
- NSColor
social
has been renamed toSocial
to match Apple Swift guidelinesmaterial
has been renamed toMaterial
to match Apple Swift guidelinesflatUI
has been renamed toFlatUI
to match Apple Swift guidelinescss
has been renamed toCSS
to match Apple Swift guidelines
✨ Enhancements
- 👕 SwiftLint
- Added SwiftLint to enforce Swift style and conventions.
- Danger
- New Date extensions
- New UIFont extensions
- added
monospaced -> UIFont
method to get the current font as monospaced font. #250 by BennX, Monospaced Font explanation
- added
- UITableView
dequeueReusableCell
now returns an optionaldequeueReusableHeaderFooterView
now returns an optional
- UICollectionView
dequeueReusableCell
now returns an optionaldequeueReusableSupplementaryView
now returns an optional
- UIAlertController
- Added
preferredStyle: UIAlertControllerStyle = .alert
toinit from error
.
- Added
- UIStoryboard
instantiateViewController
now returns an optional.
- Continuous Integration
- Travis now builds
watchOS
target.
- Travis now builds
🛠 Bugfixes
- SwifterSwift
didTakeScreenShot
now returns the notification, make sure to remove listener when you don't need it anymore.
- Swift4 / Xcode9 🎉
-
v3.2.0 Changes
API Breaking
- Swift 3.2
- Code has been updated to Swift 3.2; please use
v3.1.1
if you are still using Swift 3 or Xcode 8
- Code has been updated to Swift 3.2; please use
- SwifterSwift
userDefaults
is deprecated, use Apple'sUserDefaults.standard
instead.object(forKey: String)
is deprecated, use Apple'sUserDefaults.standard.object(forKey: _)
instead.string(forKey: String)
is deprecated, use Apple'sUserDefaults.standard.string(forKey: _)
instead.integer(forKey: String)
is deprecated, use Apple'sUserDefaults.standard.integer(forKey: _)
instead.double(forKey: String)
is deprecated, use Apple'sUserDefaults.standard.double(forKey: _)
instead.data(forKey: String)
is deprecated, use Apple'sUserDefaults.standard.data(forKey: _)
instead.bool(forKey: String)
is deprecated, use Apple'sUserDefaults.standard.bool(forKey: _)
instead.array(forKey: String)
is deprecated, use Apple'sUserDefaults.standard.array(forKey: _)
instead.dictionary(forKey: String)
is deprecated, use Apple'sUserDefaults.standard.dictionary(forKey: _)
instead.float(forKey: String)
is deprecated, use SwifterSwift'sUserDefaults.standard.float(forKey: _)
instead.set(_ value: Any?, forKey: String)
is deprecated, use Apple'sUserDefaults.standard.setValue(_, forKey: _)
instead.
- Int
- Property
romanNumeral
is now a method.
- Property
- String
- Property
lines
is now a method. - Property
mostCommonCharacter
is now a method. - Property
reversed
is now a method. - Property
unicodeArray
is now a method. - Property
words
is now a method. - Property
wordCount
is now a method.
- Property
- UICollectionView
- Property
numberOfItems
is now a method.
- Property
- UITableView
- Property
numberOfRows
is now a method.
- Property
- UIViewController
- Removed
navigationBar
that was causing app to crash, thanks to drewpitchford for reporting in #243.
- Removed
✨ Enhancements
- New Date extensions
- added
secondsSince(_ date: Date)
method to get a number of seconds between two dates. - added
minutesSince(_ date: Date)
method to get a number of minutes between two date. - added
hoursSince(_ date: Date)
method to get a number of hours between two dates. - added
daysSince(_ date: Date)
method to get a number of days between two date. - added
isInThisYear
property to check if the date is in the current year. - added
isInThisMonth
property to check if the date is in the current month. - added
isInThisWeek
property to check if the date is in the current week.
- added
- New URLRequest extensions
- added
init?(urlString: String)
fallible initializer create a URLRequest from URL string.
- added
- New UIWebView extensions
- added
loadURL(_ url: URL)
method to load a URL. - added
loadURLString(_ urlString: String)
method to load a URL string.
- added
- 0️⃣ New UserDefaults extensions
- added
subscript(key: String)
method to get values from UserDefaults using the [] operator. - added
float(forKey key: String)
method to get a Float value from UserDefaults. - added
date(forKey key: String)
method to get a Date value from UserDefaults.
- added
- 👌 Improved file structre, as in #236
- 👌 Improved README
- Removed unnecessary description in Installation section
- Updated List of All Extensions section to match the new file structure.
🛠 Bugfixes
N/A
- Swift 3.2
-
v3.1.1 Changes
API Breaking
N/A
✨ Enhancements
- New NSAttributedString extensions
- added
NSAttributedString + NSAttributedString
operator to return a new appended NSAttributedString. - added
NSAttributedString += String
operator to append a string to a NSAttributedString. - added
NSAttributedString + String
operator to return a new appended NSAttributedString. #218 by @LucianoPAlmeida
- added
- New UIColor extensions
- added
flatUI
struct with all Flat UI colors. #213 by @tache - added
coreImageColor
property to return CoreImage.CIColor. #213 by @tache - added
hsbaComponents
property to get components of hue, saturation, and brightness, and alpha. #213 by @tache - added
uInt
property to get components of hue, saturation, and brightness, and alpha as UInt. #213 by @tache
- added
- New NSColor extensions
- New UIImage extensions
- New SignedNumber extensions. #224 by @omaralbeik
- moved
abs
fromFloatingPointExtensions
andIntExtensions
- moved
isPositive
fromFloatingPointExtensions
andIntExtensions
- moved
isNegative
fromFloatingPointExtensions
andIntExtensions
- moved
string
fromFloatingPointExtensions
andIntExtensions
- moved
asLocaleCurrency
fromFloatingPointExtensions
andIntExtensions
- moved
- New SignedInteger extensions. #224 by @omaralbeik
- moved
isEven
fromIntExtensions
- moved
isOdd
fromIntExtensions
- moved
digits
fromIntExtensions
- moved
digitsCount
fromIntExtensions
- moved
timeString
fromIntExtensions
- moved
gcd(of n)
fromIntExtensions
- moved
lcm(of n)
fromIntExtensions
- moved
- ➕ Added
SwifterSwift
module_name to podspecs file to help solving conflicts with other 3rd party libraries. #226 by @omaralbeik - 🚚 Moved missing examples from the old docs. #216 by @LucianoPAlmeida
- 🆕 New
Int
extensions - 👌 Improve sum & average extensions by not relying on reduce. #225 by @SD10
- 🆕 New SVG logo in README! by @omaralbeik
🛠 Bugfixes
- 🛠 Fixed UISlider test by using XCTExpectation (#209). #229. by @LucianoPAlmeida
- New NSAttributedString extensions
-
v3.1.0 Changes
API Breaking
String
firstCharacter
has been renamed tofirstCharacterAsString
. #208 by @omaralbeiklastCharacter
has been renamed tolastCharacterAsString
. #208 by @omaralbeikfirstCharacter
has been renamed tofirstCharacterAsString
. #208 by @omaralbeikfloat
has been renamed tofloat(locale: Locale = .current)
. #208 by @omaralbeikdouble
has been renamed todouble(locale: Locale = .current)
. #208 by @omaralbeiksubscript(i: Int)
has been renamed tosubscript(safe i: Int)
. #208 by @omaralbeiksubscript(range: CountableRange<Int>)
has been renamed tosubscript(safe range: CountableRange<Int>)
. #208 by @omaralbeiksubscript(range: ClosedRange<Int>)
has been renamed tosubscript(safe range: ClosedRange<Int>)
. #208 by @omaralbeikreplacing(_ substring: String, with newString: String)
is deprecated, use Apple'sreplacingOccurrences(of: substring, with: newString)
instead. #208 by @omaralbeikint8
is deprecated, useInt8(string)
instead. #208 by @omaralbeikint16
is deprecated, useInt16(string)
instead. #208 by @omaralbeikint32
is deprecated, useInt32(string)
instead. #208 by @omaralbeikint64
is deprecated, useInt64(string)
instead. #208 by @omaralbeikfloat32
is deprecated, useFloat32(string)
instead. #208 by @omaralbeikfloat64
is deprecated, useFloat64(string)
instead. #208 by @omaralbeik
UIColor
init(hex: Int, transparency: CGFloat = 1)
is now a failable initializerinit?
. #208 by @omaralbeikinit(red: Int, green: Int, blue: Int, transparency: CGFloat = 1)
is now a failable initializerinit?
. #208 by @omaralbeikredComponent
is deprecated, use the newrgbComponenets.red
instead. #208 by @omaralbeikgreenComponent
is deprecated, use the newrgbComponenets.green
instead. #208 by @omaralbeikblueComponent
is deprecated, use the newrgbComponenets.blue
instead. #208 by @omaralbeik
✨ Enhancements
- New String extensions
- added
cgFloat(locale: Locale = .current)
to get CGFloat value from string. #208 by @omaralbeik - added
words
to return an array of all words in a string. #208 by @omaralbeik - added
wordCount
to get count of words in a string. #208 by @omaralbeik
- added
- New Int extensions
- added
countableRange
to get CountableRange 0..<Int. #208 by @omaralbeik - added
uInt
to get UInt from Int. #208 by @omaralbeik
- added
- New Array extensions
- added
group(size:)
to split in an array of slices of a size. #199. #208 by @LucianoPAlmeida - added
rotated(by:)
to return a new rotated array by the given places. #207 by @LucianoPAlmeida - added
rotate(by:)
to rotate the array by the given places. #207 by @LucianoPAlmeida
- added
- New UITextField extensions
- added
addPaddingLeftIcon(_ image: UIImage, padding: CGFloat)
to add padding to the left of the textfield rect. #203 by @xingfuqiu - added
hasValidEmail
to check if textFields text is a valid email format. #208 by @omaralbeik - added
textType
to set textField for common text types like email addresses & passwords. #208 by @omaralbeik
- added
- New UIColor extensions
- added
rgbComponenets
to get RGB components for a UIColor. #208 by @omaralbeik
- added
- ➕ Added usage examples in documentation for Foundation extensions. #208 by @omaralbeik
- 🚚 Moved many duplicated extensions from
DoubleExtensions
andFloatExtensions
into the newFloatingPointExtensions
, this makes the code easier to maintain and brings support for other FloatingPoint types like CGFloat, Double32, ... #208 by @omaralbeik
🛠 Bugfixes
- 🛠 Fixed XCTAssertNotNil cannot handle optionals. #188. by @omaralbeik
- 🛠 Fixed Tests are failing at non-english machine / Bug in String.double #187. by @omaralbeik
-
v3.0.0 Changes
API Breaking
✨ Enhancements
📚 Documentation should be greatly improved and up to date now that we are using Jazzy to auto-generate docs! :tada: #198 by @omaralbeik
👍 SwifterSwift now supports subspecs to offer more control over imported extensions: #198 by @omaralbeik
- SwifterSwift/Foundation
- SwifterSwift/UIKit
- SwifterSwift/Cocoa
Array
extensions now have throwing signatures. #170 by @LucianoPAlmeidaNew Array extensions
- added
groupByKey
to group the elements of the array by key in a dictionary. #181 by @LucianoPAlmeida - added
forEach(slice:body:)
to iterate by specified slice size and call a closure. #194 by @LucianoPAlmeida
- added
New Dictionary extensions
- add
count(where:)
to count dictionary elements where the condition returns true. #193 by @LucianoPAlmeida
- add
New String extensions
- added
isValidFileUrl
to check if a String is a valid file URL. #175 by @LucianoPAlmeida - added
hasUniqueCharacters()
method to check if string only contains unique characters. #195 by @FrankKair
- added
New Data extensions
- added
bytes
to return data as an array of bytes. #171 by @LucianoPAlmeida
- added
New UITextField extensions
🛠 Bugfixes
- 🛠 Fixes asynchronous
iOS
/tvOS
/watchOS
unit tests causing crashes. #191 by @LucianoPAlmeida
-
v1.6.4 Changes
- New Array extensions
- added
removeAll
passing an array of items. - added
swap
andsafeSwap
extensions to swap to elements in an array. - new
firstIndex
andlastIndex
that returns the (first or last) index where the condition is true. - new
indexes
extension that return indexes where the condition is true. - new
all
andnone
that checks if (all or none) of array elements match condition. - new
last
extension to find the last element that matches condition. - new
reject
extension to filter elements that not matches condition. - new
count
extension to count elements that match condition. - new
forEachReversed
extension to iterate over an array in reverse order. - new
accumulate
extension to reduces an array while returning each interim combination. - new
forEach
with condition to a filtered interaction over the array. - new
keep
extension to keep all elements that in order are until the condition is false. - new
take
extension that returns all elements that in order are until the condition is false. - new
skip
extension that returns all elements that in order are after the condition is false. - new
filtered: map
extension to perform a map and filter operation in just one iteration.
- added
- New Character extensions
- added isLetter & isWhiteSpace extensions
- new lowercased extension to lower case the character
- new uppercased extension to upper case the character
- New Date extensions
- new
isInWeekday
extension to check if the date is within a weekday period
- new
- New Dictionary extensions
- new
removeAll
extension to remove the values for all keys in an array. - new + operator to merge to dictionaries in a new one and += to merge one dictionary into another.
- new - operator to get a new dictionary with the values for all keys in an array removed and -= to remove the values for all keys in an array.
- new
- New String extensions
- new
matches
extension to check if the string matches a regex pattern.
- new
- New Locale extensions
- new posix property extension to convenience create the "en_US_POSIX" locale.
- New CLLocation extensions
- new
midLocation
to find the half-way point along a great circle path between relative to another point. - new
bearing
to calculate the bearing relative another location. ### 👌 Improvements
- new
- 🛠 Fixes on wrong access levels for some extensions
- 👌 Improve NSAttributedStringExtensions extensions
- 🛠 Fixes on implementations of some array extensions
- 🛠 Fixes on some UIButtonExtensions
- 👌 Improvements on some Date extensions
- 👌 Improvements on some methods signatures based on Swift 3 API guidelines
- 👌 Improve code coverage.
- 👌 Improvements on documentation headers
✅ Testing
🚀 This release has drastically increased test coverage: currently 92%. Areas affected are:
Foundation
- ArrayExtensions tests - CharacterExtensions tests - DateExtensions tests - DictionaryExtensions tests - StringExtensions tests - LocaleExtensions tests
UIKit
- UIColorExtensions tests - UIButtonExtensions tests
Cocoa
- CGSizeExtensions tests - CGPointExtensions tests - CLLocationExtensions tests
- New Array extensions
-
v1.6.3 Changes
New Character extensions
- new * operator (repeat character n amount of times)
- added isLowercased & isUppercased extensions
New UICollectionView extensions
- new extensions to register/dequeue cells using UICollectionViewCell class as identifier
- new extensions to register/dequeue reusable views using UICollectionReusableView class as identifier
New UITableView extensions
- new extensions to register/dequeue cells using UITableViewCell class as identifier
- new extensions to register/dequeue header/footer views using UITableViewHeaderFooterView as identifier
New UIStoryboard extensions
- added extension to
instantiateViewController
with class as identifier - added extension get
mainStoryboard
- added extension to
New UIView extensions
- added quick getter and setter for frame’s X and Y values
New Array extensions
- added
safeSwap
method as a fail-safe way to swap to elements in an array
- added
New NSView extensions
borderColor
(IBInspectable)borderWidth
(IBInspectable)cornerRadius
(IBInspectable)height
shadowColor
(IBInspectable)shadowOffset
(IBInspectable)shadowOpacity
(IBInspectable)shadowRadius
(IBInspectable)size
width
addSubviews(subviews:)
removeSubviews()
New Optional extensions
unwrapped(or:)
unwrap an optional or provide default valuerun(block:)
block to run if optional unwrapped is not nil
👌 Improvements
👌 Improve UIImageView extensions
- fixes infinite recursive call in
blurred()
method - removes superfluous error from
download(url:)
method completion block
- fixes infinite recursive call in
🗄 Replace deprecated
M_PI
with.pi
🛠 Fixes wrong implementation of -=
CGPoint
operator👌 Improve Array extensions
- properties with O(n) or higher complexity have been changed to methods
- reduced shuffle method complexity by using Fisher-Yates algorithm and is now completely random
removeDuplicates
renamed toduplicatesRemoved.
- remove generic constraint on
firstIndex(of:)
andlastIndex(of:)
👌 Improve String extensions
👌 Improve Date extensions
👌 Improve Data extensions
👌 Improve Dictionary extensions
✅ Testing
🚀 This release has drastically increased test coverage: currently 88%. Areas affected are:
Foundation
- CharacterExtensions tests - StringExtensions tests - ArrayExtensions tests - IntExtensions tests - DateExtensions tests - DataExtensions tests - DoubleExtensions tests - FloatExtensions tests - CGFloatExtensions tests - CGPointExtensions tests
UIKit
- UIColorExtensions tests - UIAlertControllerExtensions tests - UIBarButtonItemExtensions tests - UIButtonExtensions tests - UITextViewExtensions tests - UISegmentedControlExtensions tests - UINavigationControllerExtensions tests - UINavigationBarExtensions tests - UINavigationItemExtensions tests - UISliderExtensions tests - UITableViewExtensions tests - UICollectionViewExtensions tests - UIViewControllerExtensions tests - UIStoryboardExtensions tests - UITextFieldExtensions tests - UIViewExtensions tests - UIImageExtensions tests
Cocoa
- NSColorExtensions tests - NSViewExtensions tests
-
v1.6.2 Changes
- 🛠 Major bug fixes in DateExtensions.
- 🆕 New Tests.