View profile

Public Extension - Issue #9️⃣3️⃣

Welcome to this week’s Public Extension. We’re proud to be the only newsletter in the known universe
Public Extension - Issue #9️⃣3️⃣
By Joe Fabisevich • Issue #4 • View online
Welcome to this week’s Public Extension. We’re proud to be the only newsletter in the known universe that sends you a new Swift extension to make your development life easier every week.
Most extensions are brought to you by our fine community, so please reach out if you have an extension of your own that you would like to have featured! 🎉
And now onto the show. 🎭

This Week's Extension
(Click to view code in full)
(Click to view code in full)
Calculating consecutive pairs helps solve one of the one biggest problems in computer science, the off by one error. And you can use it to solve a lot of problems in your app.
Whether you’re calculating the longest consecutive sequence, adding spacers between views, creating line segments from points, or another grouping problem, consecutivePairs() can be incredibly helpful.
A consecutivePairs() example
Update: Improving Public Extension #9️⃣1️⃣
(Click to view code in full)
(Click to view code in full)
We’ve got a little improvement to Public Extension #9️⃣1️⃣ courtesy of @rolandleth.
Instead of doing this:
myCollection[[1, 2, 4, 8]]
You can now do:
myCollection[1, 2, 4, 8]
This looks nice and clean, and helps us achieve the same functionality. 💅🏽
Update 2:
Have a good rest of your weekend!
Did you enjoy this issue?
Joe Fabisevich

Public Extensions: 9/10 doctors agree that a bit of Swift code in your inbox every week is good for your soul. The other doctor has had their medical license revoked.

Sign up now and you'll wake up to a new extension in your inbox every Sunday.

And always check your sources kids.
https://github.com/mergesort/Public-Extension

If you don't want these updates anymore, please unsubscribe here
If you were forwarded this newsletter and you like it, you can subscribe here
Powered by Revue