iOS Dev Nugget 295 SwifterSwift


Need to run a code review on your codebase? Hire me

I discovered SwifterSwift recently. In its own words, it's a "A handy collection of more than 500 native Swift extensions to boost your productivity".

Some examples from

// Remove duplicates from an array
[1, 2, 3, 1, 3].removeDuplicates() -> [1, 2, 3]

date.hour = 14

"hello world".split(by: " ") -> ["hello", "world"]

"123abc".reverse() -> "cba321"

"Hèllö Wórld!".latinize() -> "Hello World!"

√ 9 -> 3

view.addShadow(ofColor .black, radius: 3, opacity: 0.5)

image.kilobytesSize -> 114 url, contentMode: .scaleAspectFit, placeHolder: UIImage?)

I'm still not sure if importing such libraries will essentially make you form your own dialect of Swift (maybe that's inevitable with all libraries), but there are definitely some gems in there and since the license is MIT, you can at least cherry pick what you want if you rather not import the entire library. So check it out!

Your feedback is valuable: Do you want more nuggets like this?   Yes   or   No



Like this and want such iOS dev nuggets to be emailed to you, weekly?

Sign Me Up! or follow @iosdevnuggets on Twitter


View archives of past issues