-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Refactored init(light:dark:) to remove deployment target version restrictions. #844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactored init(light:dark:) to remove deployment target version restrictions. #844
Conversation
Codecov Report
@@ Coverage Diff @@
## master #844 +/- ##
==========================================
- Coverage 92.81% 92.78% -0.03%
==========================================
Files 100 100
Lines 3408 3411 +3
==========================================
+ Hits 3163 3165 +2
- Misses 245 246 +1
Continue to review full report at Codecov.
|
Generated by 🚫 Danger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test for when the dark mode colour is nil
.
Done. |
convenience init(light: UIColor, dark: UIColor?) { | ||
if #available(iOS 13.0, tvOS 13.0, *), | ||
let dark = dark { | ||
self.init(dynamicProvider: { $0.userInterfaceStyle == .dark ? dark : light }) | ||
} else { | ||
self.init(cgColor: light.cgColor) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
convenience init(light: UIColor, dark: UIColor?) { | |
if #available(iOS 13.0, tvOS 13.0, *), | |
let dark = dark { | |
self.init(dynamicProvider: { $0.userInterfaceStyle == .dark ? dark : light }) | |
} else { | |
self.init(cgColor: light.cgColor) | |
} | |
} | |
convenience init(light: UIColor) { | |
self.init(cgColor: light.cgColor) | |
} | |
convenience init(light: UIColor, dark: UIColor) { | |
if #available(iOS 13, *) { | |
self.init { $0.userInterfaceStyle == .dark ? dark : light } | |
} else { | |
self.init(cgColor: light.cgColor) | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this would be neater like so ☝️
Reasons being:
The dark: UIColor?
forces you to always provide a nil
whenever you only want to use the light:
mode variant.
This makes it inconvenient to swap between use cases of just UIColor(light:)
and both UIColor(light:,dark:)
.
It is solvable by having a convenience init(light: UIColor, dark: UIColor? = nil)
allowing you to have simply UIColor(light: .red)
.
However it still doesn't prevent you from explicitly using i.e: UIColor(light: .red, dark: nil)
.
Having two convenience init
like above suggested, prevents any unnecessary code being written, as if you don't want the dark:
you'd simply not declare it.
It also removes the necessity of optional binding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The entire purpose of this initialiser is to provide callers with the option of providing 2 colours for light and dark mode. If they didn't want to provide a dark colour, why would they use this initialiser at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my exact thought, @guykogus, the only reason for the second initialiser UIColor(light:)
in my proposal above, was the ease of removing the dark:
argument on demand without having to rewrite the whole initialiser, hence it’s totally discardable.
But in that case the dark:
parameter definitely shouldn’t be Optional
as you said it yourself and I quote.
If they didn't want to provide a dark colour, why would they use this initialiser at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can foresee use cases where dark
would be optional. If you've ever worked on a template app, where you swap between different colour/asset themes, there are times where in one situation you would have a light/dark colour for one theme but then use the same colour for another. There are probably other use cases, but that's the first that comes into my mind. I really don't see any harm in having dark
as optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking something along the lines of
protocol AppTheme {
var backgroundColor: UIColor { get }
var darkModeBackgroundColor: UIColor? { get }
}
struct SimpleAppTheme: AppTheme {
var backgroundColor: UIColor { .white }
var darkModeBackgroundColor: UIColor? { nil }
}
struct FancyAppTheme: AppTheme {
var backgroundColor: UIColor { .white }
var darkModeBackgroundColor: UIColor? { .black }
}
func applyBackgroundColor(theme: AppTheme) {
backgroundColor = UIColor(light: theme.backgroundColor, dark: theme.darkModeBackgroundColor)
}
but I guess it's not really necessary, you could just replace it with:
protocol AppTheme {
var backgroundColor: UIColor { get }
}
struct SimpleAppTheme: AppTheme {
var backgroundColor: UIColor { .white }
}
struct FancyAppTheme: AppTheme {
var backgroundColor: UIColor { UIColor(light: .white, dark: .black) }
}
func applyBackgroundColor(theme: AppTheme) {
backgroundColor = theme.backgroundColor
}
Regardless, in general I wish that APIs would be more forgiving with optional values. I often find myself creating extensions to allow them because it simplifies the calls, e.g. DateFormatter.date(from: String?)
. This is often needed because when you are responding to data coming from the server you need to handle missing information, and passing along optionals can save you from a lot of if-else
statements. I really see no harm in making dark
optional here, and it can potentially do good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly @guykogus , It'd be no longer required to provide an explicitly allocated variable for darkModeBackgroundColor
as it would be handled dynamically using the UIColor(light:,dark:)
.
Otherwise just use any other initialiser like UIColor(red:,green:,blue:,alpha)
instead.
And nothing would prevent you from still using the mentioned AppTheme
approach ignoring the dynamic provider init altogether.
There's one other reason I'd avoid Optional
for that dark:
parameter that I'll formulate later. As I'm currently busy to give a full blown example 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the data coming from server, I do agree, it's useful to have an occasional Optional
to avoid a Parsing/Decoding exception right away, and handle it somewhere down the execution line.
But when it comes to UIColor
I don't thing there'd be a valid reason to have dark:
as Optional
as it promotes an unintended use of the initialiser.
The dynamicProvider: @escaping (UITraitCollection) -> UIColor
returns a non-optional type UIColor
. And the current behaviour of this init is already somewhat unpredictable, yes it may seem logical to jump back to light:
value in case the dark:
isn't supported by iOS
version. but how would you handle an addition third mode like gold:
in a future iOS
version (i.e: UIColor(light:,dark:,gold:)
)? Would you jump back to the original light:
value? or maybe dark:
instead?
Hence their Color Set
Appearance signature is either None
, Any, Dark
or Any, Light, Dark
, future-proofing potential additions of new modes if necessary.
One possibility would be to replicate the Color Set
and have:
UIColor(none:)
(totally discardable as doesn't do anything new)UIColor(any:,dark:)
UIColor(any:,light:,dark:)
Then no matter what it'd quite clear which colour is being taken when the mode is not supported.
This would allow easy future extension without requirement of modification of existinginit
s.
In this ☝️ case it'd totally make sense everything beingOptional
as it'd be replicating theColor Set
behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I think I'm in agreement to not let dark
be optional.
As for the better initialisers - I totally agree, we should be 100% replicating the way it's done in Color Set
. For now we don't want any breaking changes, and I like that the purpose of this PR is just to move the remove the version restriction for callers, so in a future PR we can deprecate this function and replace it with the second 2 initialisers that you suggested (or probably even do it in 1).
@VincentSit tl;dr can you please make dark
non-optional again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@guykogus Done.
I didn't participate on the discussion, so I'll defer the second approval to @rypyak :) |
Thanks all :) |
…alculateTextSize * origin/master: Refactored init(light:dark:) to remove deployment target version restrictions. (SwifterSwift#844) Added WKWebView extensions (SwifterSwift#851) Update UIEdgeInsets extensions link (SwifterSwift#852)
* Fix Swift Package Manager * Consistency improvement (SwifterSwift#553) * Tests consistency improvements (SwifterSwift#554) * Add initializers with Literals for UILayoutPriority (SwifterSwift#549) * Add initializers with Literals for UILayoutPriority * Added CHANGELOG entry * Undo project.pbxproj changes * Update unit tests * Remove whitespace from CHANGELOG * Remove redundant tests * Add addition operator to `UIEdgeInsets` (SwifterSwift#557) * Add addition operator to `UIEdgeInsets` * Add in-place mutating addition for UIEdgeInsets * Add `rotated(by:)` functions to `UIImage` for generating rotated images. (SwifterSwift#555) * Add `rotated(by:)` functions to `UIImage` for generating rotated images. * spaces -> tabs * Fix availability * Fix CHANGELOG message * Add SwifterSwift to comments * Added 'key(forValue: Value)' method to DictionaryExtensions (SwifterSwift#561) * Added 'key(forValue: Value)' method to DictionaryExtensions * Added 'key(forValue: Value)' method to DictionaryExtensions * Added 'key(forValue: Value)' method to DictionaryExtensions * Added 'key(forValue: Value)' method to DictionaryExtensions * Update for Swift 4.2 and Xcode 10 support (SwifterSwift#562) * Updating Code base and iOS Unit Tests. * Updating MacOS tests * Update travis image. * Updating some extensions. * Updating pod spec swift version * Updating swift version * Fixing indentation on some files. * Indenting. * Indenting some files. * Running swiftlint autocorrect --format * Workaround cocoapods issue * Updating spec, readme and changelog for new version. * Removing toggles since they are stdlib now. * Deprecating random extensions in favor of the natives. * Updating arc4_random usages. * Removing prior SwifterSwift 4.2.0 version deprecated version. * Added ancestorView(withClass:) (SwifterSwift#560) * added ancestorView(withClass:) * review changes * added PR to changelog * added ancestorView(where:) * Use 'swift_version' instead of 'pod_target_xcconfig{SWIFT_VERSION}' to specify Swift version of pod target itself. (SwifterSwift#566) * Update the CHANGELOG to correctly display what has been changed for the latest version (SwifterSwift#569) * Update the CHANGELOG to correctly display what has been changed for the latest version Close the version to create a public release * Update README and podspec for v4.6.0 * Fix README to say Xcode 10.0 and Swift 4.2 (SwifterSwift#572) * Fixed image cropped method (SwifterSwift#575) * Fixed image cropped method * Added SwifterSwift#575 pull request description * Dictionary Key-Path Subscript (SwifterSwift#574) * Created Dictionary[path:] key-path subscript for deep fetching/setting * Created DictionaryExtensionTests.testSubscriptKeypath test case * Added Dictionary[path:] subscript entry to CHANGELOG * Updated PR number in CHANGELOG for Dictionary[path:] entry * Removed extrenuous 'return' from Dictionary[path:] setter * Use for-in loop instead of .reduce in Dictionary[path:] to allow early returns * Added path count guard to Dictionary[path:] getter * Added empty path test to DictionaryExtensionTests.testSubscriptKeypath test case * Added [key, key1] path test to DictionaryExtensionTests.testSubscriptKeypath test case * Use .isEmptry instead of .count check for path length guard in Dictionary[path:] * (Maintenance) Random values (SwifterSwift#577) * Clean up usage of new random functions * Update project version to match current * Added a computed property 'yesterday' for Date and a test function for it. (SwifterSwift#578) * Added Date property "yesterday" and a test function for it. * Updated Changelog with propery for Date * Updated Changelog with propery for Date * Updated Changelog with propery for Date * Adding 'yesterday' property for Date (PR SwifterSwift#578) error fix. * Adding property 'yesterday' for Date (PR #SwifterSwift#578), comment, syntax and unit test fix * Changes made for Changelog and a test case * Added missing WhatsApp color (SwifterSwift#581) * added WhatsApp color * added changelog * Removed self. when not needed (SwifterSwift#579) * removed self when not needed * improved formatting * Add `rounded(numberOfDecimalPlaces:, rule:)` to `BinaryFloatingPoint` (SwifterSwift#583) * Add `rounded(numberOfDecimalPlaces:rule:)` to `Float` and `Double` * Add `rounded(numberOfDecimalPlaces:, rule:)` to CHANGELOG * Append pr detail to CHANGELOG * Prefer `max` over comparison, thank guykogus * Move method from `Double` and `Float` to `BinaryFloatingPoint`, thank LucianoPAlmeida (SwifterSwift#583) * Make method public SwifterSwift#583 * Minor changes * Add `BidirectionalCollection[offset:]` subscript for getting element with negative index. (SwifterSwift#582) * Add subscript nth to `Collection` where `Index` is `Int` * Add `Collection[nth:]` to CHANGELOG * Append detail to CHANGELOG SwifterSwift#582 * Move method to `BidirectionalCollection` * Move BidirectionalCollectionExtension to its own file (SwifterSwift#582) * Replace the old Date.random function with ones using the new built-in random API (SwifterSwift#576) * Replace the old Date.random function with ones using the new built-in random API * Update changelog * Add SwifterSwift to documentation * Add new extensions of `DispatchQueue` (SwifterSwift#585) * Fix unit test fail of testing date beginning (SwifterSwift#592) * Fix unit test fail of testing date beginning * Use NSTimeZone.default instead Timezone.current or Date().timezone code review by @guykogus and @jianstm * Revert testTimezone() using Date().timeZone * Remove `timeZone` from `Date` extensions (SwifterSwift#594) * Update `podspec` to make the group paths of SwifterSwift correct in Pods project (SwifterSwift#590) * Add an project of installation example with Cocoapods * Fix up `source_files` to correct the group paths of SwifterSwift in Pods project. * Use `dependency`='SwifterSwift/Shared/Color' instead of `source_files`='Sources/Extensions/Shared/ColorExtensions.swift' for subspec 'UIKit', 'AppKit' * Update `Podfile` of the example project to describe that fixed issue. * Update CHANGELOG of PR SwifterSwift#590 * Delete the test targets of example project. * Delete the example project with Cocoapods installation. * Revoke the subspec 'Shared/Color' and put back the source files to its original group 'Shared'. * Added 'tomorrow' property for Date class. (Addition to PR SwifterSwift#578) (SwifterSwift#587) * Added 'tomorrow' property for Date class * Fixed PR number * Updated test case for Date.tomorrow (pr SwifterSwift#587) * Fixed trailing space * Update CONTRIBUTING.md to mention adding a subspec for new modules (SwifterSwift#595) * Add examples playground (SwifterSwift#596) * Create playground with working examples of extensions from Examples.md * Remove Examples.md * Add Examples playground into the project * Remove number of Swift version from playground text * Update README.md to replace Examples.md with Examples.playground * Update CHANGELOG.md to include PR changes into upcoming release * Update Examples.playground - to remove sections and categories without examples - to add message to build the project before using the playground - to add "Try yourself" section - rename playground pages files * Fix SwiftLint warnings * Remove some examples which actually do not show an output in playground Update some examples to show an output in playground * Remove unuseful example from playground * Do small fixes for UIImage/UIImageView extensions examples * Fix swiftlint warnings * added UIActivityExtensions (SwifterSwift#580) * added UIActivityExtensions * added changelog * removed google plus * removed UIActivityExtensions from tvOS * updated changelog * added newline * added empty line * Added extension 'duplicates' to Sequence (SwifterSwift#605) * Added functions Added functions to count the number of times that the element occours in the array, and function to return duplicated element in the array. * Update Sources/Extensions/SwiftStdlib/ArrayExtensions.swift Co-Authored-By: dylancfe15 <dylancfe15@gmail.com> * Removed the countElement() functions. Deleted the countElement() functions and kept only the getDuplicates(). * Deleted testCountElement() * Added extension 'duplicatedElement' Added `duplicatedElements() -> [Element]` get duplicated elements from an array. * Update ArrayExtensions.swift * Added 'duplicatedElements' extension Function to return duplicated element from the original array. * Added extension 'duplicatedElements' to Array 'duplicatedElements' will return duplicated elements from the original array * Edited CHANGELOG.md * Update CHANGELOG.md * Update ArrayExtensions.swift * Update ArrayExtensions.swift * Update ArrayExtensionsTests.swift * Update ArrayExtensions.swift * Update ArrayExtensions.swift * Update ArrayExtensions.swift * Update ArrayExtensionsTests.swift * Update ArrayExtensions.swift * Update ArrayExtensions.swift * Update CHANGELOG.md Co-Authored-By: dylancfe15 <dylancfe15@gmail.com> * Added extension 'duplicates' to Sequence A function for getting the duplicated elements in a sequence. * Added extension 'duplicates' to Sequence A function for getting the duplicated elements in a sequence. * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update ArrayExtensions.swift * Update ArrayExtensionsTests.swift * Update SequenceExtensionsTests.swift * Added extension `isLeapYear` to Date Added `isLeapYear` to check whether or not the year is a leap year. * Update CHANGELOG.md * Update DateExtensions.swift * Update DateExtensionsTests.swift * Update SequenceExtensions.swift Removed countedSet, instead, using a set and an array. * Update SequenceExtensions.swift * Fix typo (SwifterSwift#609) * Adding convenience method to present a popover. (SwifterSwift#593) * Adding convenience method to present a popover. * Update CHANGELOG.md * Fixing SwiftLint warnings * Update CHANGELOG.md Co-Authored-By: marcocapano <marco24capano@icloud.com> * Update Sources/Extensions/UIKit/UIViewControllerExtensions.swift Co-Authored-By: marcocapano <marco24capano@icloud.com> * Applying PR suggestions * Update CHANGELOG.md * removing unnecessary empty line * Removing expectation * fixed test * Adding tests for size and delegate parameters * Update UIViewControllerExtensionsTests.swift * Update UIViewControllerExtensionsTests.swift * Update Tests/UIKitTests/UIViewControllerExtensionsTests.swift Co-Authored-By: marcocapano <marco24capano@icloud.com> * Updating comments based on suggestions * Adding convenience initializer and test for UILabel (SwifterSwift#607) * Adding convenience initializer and test for UILabel * Update CHANGELOG.md * fixed test * Update CHANGELOG.md Co-Authored-By: marcocapano <marco24capano@icloud.com> * Improvement common suffix extension (SwifterSwift#606) * Improving performance and tests implementation of commonSuffix. * Changelog entry. * Debug what is happening on PR builds with pod lib lint * Skipping tests on the build. * Adding another test case. * Fixing tests. * Implementation logic change. * Handle missing case and adding diacriticInsensitive test. * Improving implementation. * guard * Added FileManager.createTemporaryDirectory() to create a directory for saving temporary files (SwifterSwift#615) * Added FileManager.temporaryFileDirectory() to create a directory for saving temporary files * Set PR number * Add test for creating a file at the temporary directory * Remove temp files at end of test * Rename function to make its purpose clearer. * Only triggering push builds for master. (SwifterSwift#618) * Fixing SwifterSwift#616 bug on NSAttributedStringExtensions. (SwifterSwift#617) * Fixing SwifterSwift#616 bug on NSAttributedStringExtensions. * Changelog. * Fix typo (SwifterSwift#620) * Fixed: Minor typo in UIWindowsExtensions.swift (SwifterSwift#623) * Fix typo (SwifterSwift#628) * Upadting xcode version (SwifterSwift#635) * removing extensions not needed anymore (SwifterSwift#637) * removing extensions not needed anymore * Update CHANGELOG.md * Update CHANGELOG.md * Fix yesterday (SwifterSwift#641) Changed extension method 'yesterday' for class 'Date' to be calculated using Calendar.date(byAdding:to:) instead of addingTimeInterval(). * Fixed all SwiftLint(0.31.0)-related warnings (SwifterSwift#643) * Fixed all SwiftLint(0.31.0)-related warnings * Reverted header docs indentations. * Fixing tint UIImage extension upside down. (SwifterSwift#639) * Fixing tint UIImage extension upside down. * Changelog * Update Sources/Extensions/UIKit/UIImageExtensions.swift Co-Authored-By: LucianoPAlmeida <passos.luciano@outlook.com> * Making some array extensions, generic collection extensions (SwifterSwift#634) * Making keep(while: ), take(while: ) and skip(while:) array extensions, collection extensions. * Adding changelog entry * Adressing PR comments. * Added MKMapViewExtensions (SwifterSwift#629) * added MKMapViewExtensions * code review changes * updated project file * readded CLLocationCoordinate2D * updated test * fixed @available checks * Fix tomorrow to use Calendar.date(byAdding:to:) (Related to Issue SwifterSwift#640) (SwifterSwift#642) * Changed tomorrow method to use Calendar.date(byAdding:to:) * Changed tomorrow method to use Calendar.date(byAdding:to:) * Changed tomorrow method to use Calendar.date(byAdding:to:) * Added CHANGELOG entry * Moved the entry about the change in 'yesterday' to Fixed * Fixed a testTomorrow * v5.0 (SwifterSwift#649) * release: v5.0.0 * Update version number in Test info.plist * Update badges * - Resolved an issue where extension methods were internal instead of public. (SwifterSwift#652) * Adding Linux build to Travis CI (SwifterSwift#650) * Testing linux build on travis * Changes on travis CI * Naming Darwin * Trying linux build * Change name * Change test to build * Remove parallel * Creating test target * Executing swift test --generate-linuxmain * Separating test targets * Removing linux main * Adding check os user default tests. * Removing foundation tests for now * Removing test from linux for now. * Swiftlint * Excluding files * Remove auto generated files. * Adding auto generated files to gitignore. * Update .travis.yml * Checks on NSNSAttributedStringExtensions.swift * Checks on NSNSAttributedStringExtensions.swift * swift test * Checks on NSNSAttributedStringExtensions.swift * lint * More checks * Platform checks on linux * Testing Import Glibc * More checks * More checks * More checks * isNumeric StringExtension platform check * More checks * Againnnn more platform checks * Adding back generated files. * Removing generation that doesnt work on linux * Checks inside tests * Moving checks inside functions * Moving checks inside functions * Moving checks inside functions * More checks * Updating nspredicate tests to not use unsuported linux corelibsfoundation methods * Conditional check for not linux * Temp file extension implementation for linux * Temp file extension implementation for linux * Conditional check for not linux * Adding conditional tests * Adding conditional tests * Adding GLibc * Verbose output * Updating tomorow and yesterday * Removing verbose * Testing something * Testing something * Testing something * Putting back commented code. * Attemping work around * Link to issue * Removing some extensions from linux to make tests pass * Check conditional * Adding file config to danger swiftlint * Updating gem files * Work around swiftlint * [README] Document support for installation via Accio (SwifterSwift#658) * [README] Document support for installation via Accio * [README] Update Accio & SwiftPM installation sections in Moya style * Application Bundle Property Fixes (SwifterSwift#664) - Resolved an issue where version would return the wrong value. - Resolved an issue where displayName would return the wrong value or nil if localized. * Update Swift version to 5.0 (SwifterSwift#667) * Refactored the query value extension in URL (SwifterSwift#668) * SwifterSwift#661 `queryValue` extension refactored. * Changelog updated. * Add aspectRatio and max properties to CGSize (SwifterSwift#662) Add aspectRatio, maxDimension, and minDimension properties to CGSize * ✨ Added String.isPalindrome (SwifterSwift#671) * ✨ Palindrome * Updated CHANGELOG.MD. Added reference * Removed extra indent * 👌 Updating code due to code review changes. @guykogus * Update CHANGELOG.md Co-Authored-By: cHaLkdusT <cHaLkdusT@users.noreply.github.com> * Add function withoutDuplicates at extension Sequence (SwifterSwift#666) * Optimization code and Complexity * Add function withoutDuplicates at extension Sequence * Add change log and change function name * update changelog * remove IndexPath in testtestWithoutDuplicates * Update Tests/SwiftStdlibTests/SequenceExtensionsTests.swift Co-Authored-By: saucym <qhc_m@qq.com> * Update Sources/SwifterSwift/SwiftStdlib/SequenceExtensions.swift Co-Authored-By: saucym <qhc_m@qq.com> * Add several extensions related to SceneKit (SwifterSwift#660) * Fixing missing public modifiers (SwifterSwift#677) * Fixing missing public modifiers * Reverting modifier * Updating pod version * verbose on podlib lint * Removing pod lib lint for now. * The size of rect can equal to the size of image when cropping image. (SwifterSwift#679) * The size of rect can equal to the size of image when cropping image. * Update test of cropping UIImage. * Update CHANGELOG.md * Update CHANGELOG.md * Fixed SwiftLint Warnings (SwifterSwift#682) * Removed isNumber, isLetter, isLowercased, isUppercased and isWhiteSpace (SwifterSwift#689) * removed isNumber, isLetter, isLowercased, isUppercased and isWhiteSpace * Update CHANGELOG.md * Update CHANGELOG.md * swift test --generate-linuxmain * swift test --generate-linuxmain again * Update CHANGELOG.md * Update README.md (SwifterSwift#692) Add missing 'SwifterSwift/UIKit' on CocoaPods installation guide * fix SwifterSwift#693 [UITableViewExtensions] : Crash in iOS 13.0 (XCode 11.0) due to returning wrong last section (0) even for the empty tableView (SwifterSwift#694) * 🚀`isValidIndexPath(_:)` will now return `false` for IndexPaths with a negative row or section (SwifterSwift#696) * `isValidIndexPath(_:)` will now return `false` for IndexPaths with a negative row or section * Added PR number to changelog * Moved && to the end of the line * 🚀 Added `isValidIndexPath(_:)` UICollectionView method and test (SwifterSwift#695) * Added `isValidIndexPath` extension and test * Changelog pre-entry * Added PR Number to changelog * Checking for negative IndexPaths as well * Fixing whitespaces * Moved && to the end of the line * Removed an empty line * Updating gem files (SwifterSwift#697) * Added CollectionView.safeScrollToItem(at:, at scrollPosition: , animated:) (SwifterSwift#698) * Updating bundle (SwifterSwift#699) * remove duplicate optional link (SwifterSwift#700) * Update StringExtensions.swift (SwifterSwift#701) More elegant * Add convenience initializer extensions for UIBezierPath (SwifterSwift#659) * Add convenience initializer extensions for UIBezierPath * Add additional documentation to UIBezierPath extensions * Refactor helper property in UIBezierPathExtensionsTests * Added backgroundColor to NSView SwifterSwift#534 (SwifterSwift#702) * Added backgroundColor to NSView this will allow to set and get background color of NSView * Made backgroundColor as public properly Made backgroundColor as public property as per guideline * Moved backgroundColor with other property Moved backgroundColor with other property * added test testBackgroundColor added test testBackgroundColor * Update NSViewExtensionsTests.swift * Added change log for NSView - backgroundColor Added change log for NSView - backgroundColor property * Fixed issues with test case - backgroundColor Fixed issue related with test case backgroundColor * Removed self Removed self as per contributor's suggestion * Updated text Updated text * Swiftlint changes Swiftlint changes * swiftlint autocorrect * Added missing backgroundColor * Deleted duplicated NSViewExtensions.swift * Removed () + self where possible * backgroundColor's comment proposed by guykogus * Update CHANGELOG.md * Update CHANGELOG.md * Removed public for extensions, IBInspectable formatting * Removed spaces * Reverted spaces, added testBackgroundColor again * Use the original scale of the source image (SwifterSwift#703) * Modifed the scale methods in UIImageExtensions.swift, to use the original scale of the source image * Update CHANGELOG.md * Add a probot stale configuration (SwifterSwift#705) * Add a probot stale configuration See Issue SwifterSwift#644 Also see https://github.com/probot/stale * Add suggestions of @LucianoPAlmeida * ♻️ Refactor sum() to make it more Swift-er (SwifterSwift#707) * Refactor sum() to make it more Swift-er * Updated CHANGELOG.md * Update Sources/SwifterSwift/SwiftStdlib/SequenceExtensions.swift Co-Authored-By: Luciano Almeida <passos.luciano@outlook.com> * ♻️ Moved divided(by:) function from ArrayExtensions to SequenceExtensions (SwifterSwift#706) * ✨ Added Collection.split(where:) helper function * Updated CHANGELOG.md * Fixed typo * 👌 Updating code due to code review changes * Removed unnecessary whitespaces * 🚨 Fixed linter warnings * 💚 Fixing CI Build * Array.withoutDuplicates(keyPath:) (SwifterSwift#704) * removeDuplicates and withoutDuplicates with params removeDuplicates(by comparator: (Element, Element) -> Bool) -> [Element], removeDuplicates<E: Equatable>(keyPath path: KeyPath<Element, E>) -> [Element], withoutDuplicates(by comparator: (Element, Element) -> Bool) -> [Element], withoutDuplicates<E: Equatable>(keyPath path: KeyPath<Element, E>) -> [Element] * Fixed examples [1, -1, 2, -4, 3, 3, 3, 4, -5] -> [1, 2, -4, 3, -5] * Tests for new removeDuplicates and withoutDuplicates testRemoveDuplicatesUsingComparator, testRemoveDuplicatesUsingKeyPath, testWithoutDuplicatesUsingComparator, testWithoutDuplicatesUsingKeyPath * Added Added removeDuplicates(by:), removeDuplicates(keyPath:), withoutDuplicates(by:), withoutDuplicates(keyPath:) * Changed removeDuplicates and withoutDuplicates * Added removeDuplicates and withoutDuplicates where Element: Hashable * New Array extension for Element: Hashable * Fixed tests * Remove Set from tests * Optimised methods by Luciano Almeida * Update CHANGELOG.md * Fixing Codecov report * Reverted CHANGELOG.md * Reverted ArrayExtensions.swift * Reverted ArrayExtensionsTests.swift * Tests for withoutDuplicates(keyPath:) * Added Array.withoutDuplicates(keyPath:) * Added withoutDuplicates(keyPath:) * Autogenerated Equatable * Array -> Set * Tests for func withoutDuplicates<E: Equatable>(keyPath path: KeyPath<Element, E>) -> [Element] * Added func withoutDuplicates<E: Equatable>(keyPath path: KeyPath<Element, E>) -> [Element] * withoutDuplicates -> withoutDuplicatesUnordered * Tests for withoutDuplicatesUnordered * Less tests for withoutDuplicates(keyPath:) * Only 1 withoutDuplicates * Tests for withoutDuplicates(keyPath:) * A better way to create set Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * remove -> filtering Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Removed comment (clean code) * a set -> an array Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * a set -> an array in method description Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * withoutDuplicates for Equatable and Hashable * swiftlint autocorrect * Tests for 2 withoutDuplicates(keyPath:) * short names * var city -> let city Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Optional location * Person is not Hashable * Documenting String appendingPathComponent (SwifterSwift#709) * Sorted key path improvements (SwifterSwift#712) * Deprecating sort(by keyPath: ascending:) in favor of sort(by keyPath: with:) * Updating linux tests * Changelog * Spacing. * Default version. * Changing default. * release: v5.1.0 (SwifterSwift#713) * String with prefix (SwifterSwift#720) * Added replacingOccurrences extension to String * Added withPrefix method to String extension * Update CHANGELOG.md * Remove duplicate entry * Remove unneccessary self and favor string addition to string interpolation * Remove replacingOccurrences function as it's in a separate PR SwifterSwift#719 * Favor using guard over if for early exit condition * Move comment inside method body per omaralbeik's suggestion * Updated per suggestion * Add withBackgroundColor(_:) extensions to UIImage (SwifterSwift#721) * Add withBackgroundColor(_:) extensions to UIImage * Add changelog entry for UIImage.withBackgroundColor(_:) * Change username vyax to MaxHaertwig * Use UIGraphicsImageRenderer on iOS 10+ * Add missing tvOS version check * Exclude extension from watchOS * NSRegularExpression extensions (SwifterSwift#727) Add `NSRegularExpression` extensions to remove usage of `NSString`, `NSRange` and `UnsafeMutablePointer<ObjCBool>` * Add init(light:dark:) to NSColor and UIColor (SwifterSwift#722) * Add init(light:dark:) to NSColor and UIColor * Conditionally import Cocoa * Add missing canImport(UIKit) checks * Add test for NSColor.init(light:dark:) * Fix cocoa import check * Expose NSColor extension to objc * Make OS check at runtime * Add custom SwiftLint rules (SwifterSwift#725) Closes SwifterSwift#545 * Added 'applyGradient' method to UIViewExtensions (SwifterSwift#726) * Added applyGradient method to UIViewExtensions * Added applyGradient method to UIViewExtensions.swift * Added testApplyGradient to UIViewExtensionsTests.swift * Updated CHANGELOG.md * Removed applyGradient(:) from UIViewExtensions and made it in CAGradientLayerExtension. * Update CHANGELOG.md Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Update CHANGELOG.md Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Update Sources/SwifterSwift/CoreAnimation/CAGradientLayerExtensions.swift Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Update Sources/SwifterSwift/CoreAnimation/CAGradientLayerExtensions.swift Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Added tests to check all of the values * Added !os(Linux) check as the build was failing for Linux. * Added non-nil values to locations for test. * Add sum(for keyPath:) to Sequence (SwifterSwift#736) * 🚀 UIGraphicsImageRenderer in filled(withColor:) (SwifterSwift#733) * Converted filled(withColor:) to use UIGraphicsImageRenderer when available * Dropped watchOS support for UIImage.filled(withColor:) and added CHANGELOG entry * Patched filled(withColor:) to work on all platforms with the latest APIs when available * Remove unnecessary parameter parentheses Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Reverted Xcode project to initial state, better organized changelog * Improve UIImage.tint(color:blendMode:) using UIGraphicsImageRenderer (SwifterSwift#734) * Update tint(_: blendMode:) func to use UIGraphicsImageRenderer when available * Remove watchOS support - UIGraphicsImageRenderer not available - for tint(_: blendMode:) function * Update CHANGELOG.md * Dev review required changes * Code refactor * Update CHANGELOG.md * Moved watchOS check inside tint(_: blendMode: alpha:) -> UIImage and withBackgroundColor(_:) -> UIImage functions * Add missing import and fix podspec (SwifterSwift#739) * Add missing import * Re-enable pod lib lint as part of the travis build * Remove verbose pod lib lint so that travis isn't terminated * Create a separate task for running the pod lint * Split the pod lint tasks * Fix watchOS destination (SwifterSwift#745) * Add flexibleSpace and fixedSpace(width:) extensions to UIBarButtonItem (SwifterSwift#728) * Add flexibleSpace and fixedSpace(width:) extensions to UIBarButtonItem * Ad test for UIBarButtonItem.flexibleSpace * Modify test for UIBarButtonItem.flexibleSpace * Update CHANGELOG.md Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Fix indentation * Fix merge conflicts * add base64 UIImage initialiser SwifterSwift#741 (SwifterSwift#744) Closes SwifterSwift#741 * Array mutable remove duplicates (SwifterSwift#737) * Add mutating Mutating versions of removeDuplicates(keyPath:) with tests * Edit changelog * Edit changelog * Update Sources/SwifterSwift/SwiftStdlib/ArrayExtensions.swift Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Update Sources/SwifterSwift/SwiftStdlib/ArrayExtensions.swift Co-Authored-By: Luciano Almeida <passos.luciano@outlook.com> * Fix removeDuplicates(keyPath:) code style * Update CHANGELOG.md Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Fix Changelog * Fix removeDuplicates code style * Remove discardableResult, change comments to methods * Move removeDuplicates methods to RangeReplaceableCollection * Move testing structs to separate file * Update CHANGELOG.md Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Update CHANGELOG.md Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Add comment for structs in TestHelpers * Xcode 11.2 (SwifterSwift#752) * Fix compilation and (most) tests for Xcode 11 and macCatalyst * Replace imports of Cocoa with AppKit * Update Xcode version in README * Unify Color usages * Fix subspecs * Upgrade to Xcode 11.2 * Add `init(grouping:by:)` for Dictionary that uses a keypath. 🚀 (SwifterSwift#751) * Add `grouped(by:)` function for sequences. * Fix SwiftLint whitespace warnings * Update Test cases * Add dictionary keypath grouping init and tests * Apply suggestions from code review Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Update change log for new Dictionary init * Remove sequence extension * Apply suggestions from code review Co-Authored-By: Luciano Almeida <passos.luciano@outlook.com> * Update to UIImage extensions and new init 🚀 (SwifterSwift#753) * Update `UIImage` with refactor and new `init?(url:scale:)` * Modified UIImage extension compressed so it doens't use other extension SwifterSwift#755 🚀 (SwifterSwift#757) * Make group(by:) generic for all Collections (SwifterSwift#758) * Add base64String methods to UIImage (SwifterSwift#747) Add base64String functions for png and jpeg representations * added assignToAll to MutableCollection (#issue/759) 🚀 (SwifterSwift#760) * Exclude AppKit extensions to be compiled for macCatalyst (SwifterSwift#762) * Exclude AppKit extensions to be compiled for macCatalyst * Add KeyedDecodingContainer extensions (SwifterSwift#750) * Add KeyedDecodingContainer extensions. * Minor changes, refactor * Update CHANGELOG.md * Swift lint refactor * Remove trailing whitespace * Add Foundation import * Remove unnecessary do catch block * Code refactor * Dev review required changes * Remove empty lines * Update Foundation import * Update KeyedDecodingContainerTests.swift Make CodingKeys enum private. * Update Sources/SwifterSwift/SwiftStdlib/KeyedDecodingContainer.swift Remove not needed CodingKey conformation. Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Update Sources/SwifterSwift/SwiftStdlib/KeyedDecodingContainer.swift Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Update Sources/SwifterSwift/SwiftStdlib/KeyedDecodingContainer.swift Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Code review required changes. * Sequence.mapByKeyPath (SwifterSwift#763) * map<T> * testMapByKeyPath * map(by:) * Update CHANGELOG.md Co-Authored-By: Luciano Almeida <passos.luciano@outlook.com> * Fixed build errors in KeyedDecodingContainerTests (SwifterSwift#764) * Update KeyedDecodingContainerExtensionsTests.swift * Correct file name * Update Tests/SwiftStdlibTests/KeyedDecodingContainerExtensionsTests.swift Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * swiftlint:disable:this force_try * Removed empty lines * Sequence.compactMapByKeyPath (SwifterSwift#766) * Fixing swiftlint on travis failing on travis (SwifterSwift#765) * Creating a step for swiftlint * Excluding folder installed by travis * Fixing swiftlint docs custom warnings * Filter by key path (SwifterSwift#771) * Bump excon from 0.67.0 to 0.71.0 (SwifterSwift#779) Bumps [excon](https://github.com/excon/excon) from 0.67.0 to 0.71.0. - [Release notes](https://github.com/excon/excon/releases) - [Changelog](https://github.com/excon/excon/blob/master/changelog.txt) - [Commits](excon/excon@v0.67.0...v0.71.0) Signed-off-by: dependabot[bot] <support@github.com> * Add sorted(like:keyPath:) to Array (SwifterSwift#772) * Add sorted(like:keyPath:) to Array to sort an array like another array based on a keyPath * Update Sources/SwifterSwift/SwiftStdlib/ArrayExtensions.swift Co-Authored-By: Luciano Almeida <passos.luciano@outlook.com> * Update CHANGELOG.md Co-Authored-By: Luciano Almeida <passos.luciano@outlook.com> * Rename variables in `testSortedLike` test Co-authored-by: Luciano Almeida <passos.luciano@outlook.com> Co-authored-by: Guy Kogus <guy.kogus@gmail.com> * Add localizedPrice SKProduct extension (SwifterSwift#781) * GitHub Actions (SwifterSwift#783) * Unify UIEdgeInsets and NSEdgeInsets (SwifterSwift#785) * Danger API key expose to forks (SwifterSwift#784) * Update CI.yml * Update CI.yml * Update CI.yml * Update CI.yml * Update CI.yml * Update CI.yml * Update CI.yml * Update CI.yml * Update CI.yml * Update CI.yml * Update CI.yml * Update CI.yml * Add tests for UIImage.compressedData(quality:) (SwifterSwift#786) * added UIImage base64 initialiser * added Base64 Test + fixed base64 init documentation (XC markup) * added to changelog * added SwiftLint formatting for merge (SwifterSwift#744 (comment)) * improved after review notes from @guykogus + added size test + added byteSize test * Update Tests/UIKitTests/UIImageExtensionsTests.swift Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * added testCompressedData() UTest to improove codeCov * added testCompressedData() UTest to improove codeCov + updated changelog * Update Tests/UIKitTests/UIImageExtensionsTests.swift Bundle.init Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Update CHANGELOG.md * Update UIImageExtensionsTests.swift * Update CHANGELOG.md Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Update CHANGELOG.md Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> Co-authored-by: Guy Kogus <guy.kogus@gmail.com> Co-authored-by: Luciano Almeida <passos.luciano@outlook.com> * Added zoom extension to MapView (SwifterSwift#723) * Added multipleCoordinateZoom extension to MapView * added changelog * edited edgeInsets * Update Sources/SwifterSwift/MapKit/MKMapViewExtensions.swift removed self Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Update Sources/SwifterSwift/MapKit/MKMapViewExtensions.swift removed self Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * remove available operator * empty control of arrays was performed. * insets parameter and changelog update * comments update * method name and changelog update * added testWithEmptyItemArray test method * added testWithOneItemArray test method * added testWithMultiItemArray test method * update changelog and zoom method * Update CHANGELOG.md Co-Authored-By: Luciano Almeida <passos.luciano@outlook.com> * space update * Update Tests/MapKitTests/MKMapViewTests.swift Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Update Tests/MapKitTests/MKMapViewTests.swift Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Update Tests/MapKitTests/MKMapViewTests.swift Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Update Tests/MapKitTests/MKMapViewTests.swift Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Update Tests/MapKitTests/MKMapViewTests.swift Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Update Tests/MapKitTests/MKMapViewTests.swift Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * update spaces * Update CHANGELOG.md Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * zoom test methods edited * Tests for zoom the MapView extension have been edited * edited emptyArray test and imported UIKit * EdgeInsets added as typealias * pod lint issue fixed * EdgeInsets typealias moved to MKMapViewExtensions file * removed typealias from MKMapViewExtensions * edited all zoom test functions and EdgeInsets * Update Tests/MapKitTests/MKMapViewTests.swift Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * swiftlint warning fixed Co-authored-by: Guy Kogus <guy.kogus@gmail.com> Co-authored-by: Luciano Almeida <passos.luciano@outlook.com> * Update .codecov.yml (SwifterSwift#788) * Add cURL extension to URLRequest * Added is12HourTimeFormat to indicate if locale has 12h format (SwifterSwift#793) * Improvement of NSAttributedString extension's 'applying' function (SwifterSwift#791) * Add CLVisit extensions * Add sort(by:and:), sorted(by:and:), sort(by:and:and:), and sorted(by:and:and:) to sort collections/sequences by multiple key paths (SwifterSwift#796) * Added model parsing extension to codable (SwifterSwift#797) * [CoreLocation] add extension to calculate all elements distance in array * Upgrade swifterswift ios version (SwifterSwift#800) * changrd ios version target * removed < 10.0 available checks for ios * updated pod spec * updated readme * updated pull request template Co-authored-by: Luciano Almeida <passos.luciano@outlook.com> * [BugFix] Making String.base64Decoded a safe base64 decode by including padding. (SwifterSwift#801) * Making String.base64Decoded a safe base64 decode by including padding. * Changelog * Add min. platform to SPM (SwifterSwift#803) * Add min. platform to SPM Fixes SwifterSwift#800 . * Remove trailing comma * Conform Optional to Equatable when Wrapped conforms to RawRepresentable and RawValue is Equatable (SwifterSwift#804) * Conform RawRepresentable to Equatable with its RawValue * Make the extensions public * Clean comment * Add != operators * Fix compilation for Linux * Remove unnecessary RawRepresentable implementation * Mark equality functions as inlinable to match the Swift stdlib * Update bundle * Remove reverted CHANGELOG entry * Remove unnecessary non-optional implementations * [tests] Using automatic tests discovery on linux (SwifterSwift#808) * [tests] Using automatic tests discovery of tests in linux * Updating swift version on linux * Fix image cropped issue when scale not equal to 1 (SwifterSwift#811) * Fix image cropped issue when scale not equal to 1 * Update change log * Fix swiftlint * Convert ISO region code into flag emoji (SwifterSwift#813) * Convert ISO region code into flag emoji * Fix tests for Linux * Observe a single posting of a notification (SwifterSwift#812) * Observe a single post of a notification * Remove old references to XCTestManifests files * Added CGRect extensions and its tests (SwifterSwift#814) * Added CGRect extensions and its tests * Define anchor as CGPoint instead of enum Co-authored-by: Guy Kogus <guy.kogus@gmail.com> * Updated center text and image extension for UIButton (SwifterSwift#807) Refactor `centerTextAndImage(spacing:)`: so that the image position can be above the text * Add initializer for a `URL` with an optional `String` (SwifterSwift#818) * String Safely subscript - out of bounds (Issue SwifterSwift#815) (SwifterSwift#816) * String Safely subscript - out of bounds SwifterSwift#815 * Updated CHANGELOG.md * 🚨 Fix SwiftLint issues * 👌 Updating code due to code review changes. * String Safely subscript - out of bounds SwifterSwift#815 * Updated CHANGELOG.md * 🚨 Fix SwiftLint issues * 👌 Updating code due to code review changes. * 🚨 Fix SwiftLint issues * Refactored String subscript (safe substring) 👌 Updating code due to code review changes. * Update Sources/SwifterSwift/SwiftStdlib/StringExtensions.swift Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> Co-authored-by: Guy Kogus <guy.kogus@gmail.com> * Make CATransform3D Swifty (SwifterSwift#819) * Make CATransform3D swifty * Fix imports for test * Add rule for ignoring x, y, z for SwitLint identifier_name rule * Project clean (SwifterSwift#820) * Fix project and tests * Remove unnecessary availability attributes * Fix test crashing when it fails * Update README.md (SwifterSwift#821) * release: v5.2.0 (SwifterSwift#823) * patch: add available in SKProductExtensions.swift * Access/update RangeReplaceableCollection by index offsets (SwifterSwift#826) * Access/update RangeReplaceableCollection by index offsets This is especially useful for `String`s. * Make `NSAttributedString.applying(attributes:)` public (SwifterSwift#832) * NSAttributedString make public * Updated changelog * Update Tests/FoundationTests/NSAttributedStringExtensionsTests.swift Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Test doesn't have any attributes * 👌🏼 Updated test case due to code review changes * Update Tests/FoundationTests/NSAttributedStringExtensionsTests.swift Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Update Tests/FoundationTests/NSAttributedStringExtensionsTests.swift Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * 🚨 Removing linter warnings. * Update Tests/FoundationTests/NSAttributedStringExtensionsTests.swift Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> * Update Tests/FoundationTests/NSAttributedStringExtensionsTests.swift Co-Authored-By: Guy Kogus <guy.kogus@gmail.com> Co-authored-by: Guy Kogus <guy.kogus@gmail.com> * Added `first(where:equals:)` extension to Sequence (SwifterSwift#836) * Add `SKNode` anchor points for `center`, `topLeft`, `topRight`, `bottomLeft`, `bottomRight` (SwifterSwift#835) * Add Unit-Tests for each anchor point get and set operation * Change `SpriteKitTests` file and enclosing class names to `SKNodeExtensionTest` * Add `CHANGELOG.md` entry * [CI] Update to XCode 11.4 and package tools to 5.2 (SwifterSwift#837) * Added `last(where:equals:)` extension to Sequence (SwifterSwift#838) * CGSize: Added new `+`, `+=`, `-` and `-=` operator extensions for tuple (SwifterSwift#841) * Added new `+`, `+=`, `-` and `-=` operator extensions for tuple (width: CGFloat, height: CGFloat) * Removing semantically incorrect operator * Little arrangements * [Trivial] Adjust macOS on SwiftLint job * Update UIEdgeInsets extensions link (SwifterSwift#852) * Added WKWebView extensions (SwifterSwift#851) * Added WKWebView extensions * Refactoring tests * Adding Pod subspec for WebKit and section for WebKit Extensions in Readme Increasing WKWebView test expectation timeout * Replacing test url with https://example.com/ Handling failed events * Adding test for Dead URL String Co-authored-by: Guy Kogus <guy.kogus@gmail.com> * Refactored init(light:dark:) to remove deployment target version restrictions. (SwifterSwift#844) * Refactored to remove deployment target version restrictions. * Added test for when the dark mode color is nil. * Updated UIColorExtensionsTests. * Make dark in UIColor(light:dark:) non-optional. Co-authored-by: Luciano Almeida <passos.luciano@outlook.com> * CoreAnimation: Make CAGradientLayer extension public. (SwifterSwift#856) * CoreAnimation: Make CAGradientLayer extension public. * Update CHANGELOG. * Added convenient wrapper to asyncAfter (SwifterSwift#859) * Added convenient wrapper to asyncAfter * Added unit test for asyncAfter * Added changes to changelog * Made minor changes Co-authored-by: Guy Kogus <guy.kogus@gmail.com> * Overloaded 'contains' operator for string regex matching (SwifterSwift#858) Co-authored-by: Luciano Almeida <passos.luciano@outlook.com> * Deprecated map(by:), compactMap(by:), filter(by:) (SwifterSwift#862) * Deprecated map(by:), compactMap(by:), filter(by:) * Removed tests for map(by:), compactMap(by:), filter(by:) Co-authored-by: Luciano Almeida <passos.luciano@outlook.com> * fixed "".truncated crashed (SwifterSwift#866) * - fixed: "".truncated crashed * Update StringExtensionsTests.swift * Update CHANGELOG.md * Clean up code (SwifterSwift#864) * Clean up code Optimise some function compilation times `CAGradientLayer.init` - add default values for `startPoint` and `endPoint`. * Updated CHANGELOG * Clean up forEachInParallel * Fix WKWebView tests * Clean code and fix DispatchQueue tests Co-authored-by: Ratul sharker <sharker.ratul.08@gmail.com> Co-authored-by: Omar Albeik <omaralbeik@gmail.com> Co-authored-by: diamantidis <diamantidis@outlook.com> Co-authored-by: Guy Kogus <guy.kogus@gmail.com> Co-authored-by: Maulik Sharma <maulik1126@gmail.com> Co-authored-by: Luciano Almeida <passos.luciano@outlook.com> Co-authored-by: Hannes Staffler <overovermind@gmail.com> Co-authored-by: Daniel Lin <linzhdk@gmail.com> Co-authored-by: Ilya Khalyapin <962426@mail.ru> Co-authored-by: Caleb Kleveter <caleb.kleveter@gmail.com> Co-authored-by: Alexei <esqlimite@HOTMAIL.COM> Co-authored-by: Hannes Staffler <hannes@staffler.xyz> Co-authored-by: Quentin Jin <jianstm@gmail.com> Co-authored-by: Cruz <cruzdiary@gmail.com> Co-authored-by: Maxim Tsvetkov <777.maxxx@gmail.com> Co-authored-by: Difeng Chen <dylancfe15@gmail.com> Co-authored-by: Adrian <adrian.bolinger@me.com> Co-authored-by: Marco Capano <marco24capano@icloud.com> Co-authored-by: towry <towry@users.noreply.github.com> Co-authored-by: Stephen Feather <sfeather@gmail.com> Co-authored-by: lowol <mailaddr1@gmail.com> Co-authored-by: Piotr Byzia <piotr.byzia@gmail.com> Co-authored-by: Chad Hulbert <chulbert@users.noreply.github.com> Co-authored-by: Cihat Gündüz <github@cihatguenduez.de> Co-authored-by: Max Härtwig <vyaxxx@gmail.com> Co-authored-by: Julius Wilson Lundang <cHaLkdusT@users.noreply.github.com> Co-authored-by: 书生 <qhc_m@qq.com> Co-authored-by: dirtmelon <0xffdirtmelon@gmail.com> Co-authored-by: John <45474221+DrBeta@users.noreply.github.com> Co-authored-by: Roman Podymov <podymfrombryansk@yandex.ru> Co-authored-by: Ahmed Hamdy <dimo.hamdy@gmail.com> Co-authored-by: Mohshin Shah <mohshinshah@gmail.com> Co-authored-by: Emil Bellmann <emilrbellmann@gmail.com> Co-authored-by: matthewyan <pigphone@gmail.com> Co-authored-by: xiaozao2008 <xiaozao2008@msn.cn> Co-authored-by: Shannon Chou <shannonchou@126.com> Co-authored-by: Benjamin Meyer <bennimeyer@web.de> Co-authored-by: Zach Frew <zachary.frew@protonmail.com> Co-authored-by: Jay Mehta <jaymmehta97@gmail.com> Co-authored-by: Moritz Sternemann <moritzsternemann@users.noreply.github.com> Co-authored-by: Michael Hulet <michael@hulet.tech> Co-authored-by: Francesco Deliro <f.deliro@gmail.com> Co-authored-by: Henry <storch99@gmx.de> Co-authored-by: iglushchuk <musicguy675@gmail.com> Co-authored-by: Morgan Dock <mmdock@users.noreply.github.com> Co-authored-by: Soltan Gheorghe <soltangh.work@gmail.com> Co-authored-by: Francesco Deliro <francesco.deliro@glovoapp.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Batuhan Saka <strawb3rryx7@gmail.com> Co-authored-by: Henry <thisisthefoxe@gmail.com> Co-authored-by: Mustafa GÜNEŞ <gunes149@gmail.com> Co-authored-by: DimaZava <dimazava@hotmail.com> Co-authored-by: Trevor Phillips <trevorcoreyphillips@gmail.com> Co-authored-by: Wouter Bron <wousser@icloud.com> Co-authored-by: Chen <qchenqizhi@gmail.com> Co-authored-by: Omar Albeik <omar@backbase.com> Co-authored-by: Tigran Hambardzumyan <hamtiko@gmail.com> Co-authored-by: Rypyak <60757956+rypyak@users.noreply.github.com> Co-authored-by: Tigran Hambardzumyan <tigran@stdevmail.com> Co-authored-by: Matt Weathers <matthew.b.weathers@gmail.com> Co-authored-by: Vincent <vincentxueios@gmail.com> Co-authored-by: Den Andreychuk <32373518+denandreychuk@users.noreply.github.com> Co-authored-by: Vato Kostava <vkost16@freeuni.edu.ge> Co-authored-by: phil zhang <goo.gle@foxmail.com>
Checklist
@available
if not.See the earlier discussion about the reason for creating this PR.
For
NSColor
, sinceinit (cgColor:)
returns an optional value, it may cause a break change. We may need further discussion.