Recreating the ever-popular duotone look from Spotify’s branding

Image for post
Image for post
Duotone with an extra gradient effect.

Back in 2015, Spotify went through a rebranding effort that involved a much flatter design along with bright, bold, and complementary colors. This new branding style extended throughout the service, including things like promo material and playlist cover art. To get the desired look, they used something called a duotone effect on their imagery.

In this piece, we’ll look at how we can recreate that effect using CoreImage in iOS. Thankfully, Apple was quite faithful to industry techniques for photo manipulation when they built the CoreImage library. …


Do your text views show…?

Image for post
Image for post

One of the challenges you might encounter when working with UITextViews is that they don’t provide a straightforward way to detect whether or not they are displaying truncated text.

With a UILabel you can check for truncation by calculating the size of the text within the label and comparing that with the bounds of the label itself. If the text extends beyond the bounds then it’s being displayed as truncated.

The challenge with UITextView is that, by design, it can hold text that is far larger than its bounds.

This is the essence of how a scrolling text view operates. That feature breaks our ability to quickly check for truncation, so to begin with, we need to work with a textview that has scrolling disabled. …


Become a more effective and empathetic reviewer

Image for post
Image for post
©Asana https://blog.asana.com/2016/12/7-ways-to-uplevel-your-code-review-skills/

Reviewing code is an daily occurrence for developers. It can be a humbling learning experience, but it can also turn into an egocentric process. Over the last few years I’ve learned some best practices, either through personal experience or excellent advice from peers, that have helped me to become a more effective and empathetic reviewer. I wanted to share some of this information, in the hopes that it will help others. This short post is broken into two main parts: 1. getting the best feedback on your work and 2. providing great reviews for your peers.

Structuring Your PR’s to Make Their Life Easy

Image for post
Image for post
@iamdeveloper https://twitter.com/iamdevloper/status/397664295875805184

Avoid massive changelogs

  • Keep it small — under 300 lines of changes, if possible. …


Image for post
Image for post

This a quick one for you. Remember the screensaver that would to show up on your old CRT tv when the DVD player went to sleep? I loved that, didn’t you? There was always a shred of hope that you’d get to see it perfectly hit the corner. Let’s recreate that using SpriteKit. As always, the repo link with a complete Playground will be available at the end of this article.

To start out we will need to create some basic structure for the scene. This will consist of an SKView, an SKNode, and an SKScene. …


A detailed guide to handling events through UIMenuController with Swift

Image for post
Image for post

This piece focuses on the UIMenuController functionality and how it interacts with the UIResponder chain for handling events. It assumes that you are at least somewhat familiar with both, but if not please go read up a bit before continuing. You can also find an example project of this at the end.

Alright, now let’s get into the main portion of this. When a UIMenuController is displayed, it needs to have a firstResponder object. Usually, you just set the view that you want to display the menu above as the first responder and you’re good to go, but what if you want to show this menu above one view while another view is acting as the first responder? For example when a UITextView/UITextField is active and a user is typing something without having the keyboard dismiss. …


Image for post
Image for post

Awhile back I worked on a project where the networking layer was built around a promise-based architecture using PromiseKit. While building within it I needed to figure out how best to handle multiple, simultaneous network calls when using promises. This post is a trip through the process I took to solve that problem.

Disclaimer: I am by no means an expert in PromiseKit. If you find errors or know of a better solution please leave a comment below.

The requirement:

Execute multiple promise based network calls at the same time, and then combine the returned data into a single object once all calls are complete. …


Edited (6/24/18): This story was imported from my old personal blog. Apologies ahead of time for wonky code blocks. Also I’ve learned an enormous amount since then, including that this usually isn’t a great strategy for code separation. For historical purposes I’m leaving it here though.

Say you are trying to make an iOS app that uses a UITableView. …


Today, seeminly out of the blue, Microsoft unveiled their new code editor project titled Visual Studio Code at Build. What’s special about this editor that differentiates it from other Microsoft products is that it is cross-platform for Windows/OSX/Linux. With it’s native support for ASP.NET 5 and NodeJS application development, this could seriously improve .NET development outside of the Windows ecosystem.

You can get this new editor here. Along with the download there is already a good amount of documentation up there on their site to help you get up and running. …


Startup is an interesting word. If you search it on Wikipedia you’ll get the following blurb…

A startup company or startup is a business in the form of a company, a partnership or temporary organization designed to search for a repeatable and scalable business model.

That’s cool. Those are the things that print money right? Hmm…probably not so much, but Steve and I made one anyways. It’s called CodeHelp, and it’s aimed at helping our fellow students at St. Cloud State University with programming projects and problems. …


So I’m deviating away from my tradional topic of web development for a bit. This is because my friend and I came up with an idea for an iOS app, (beer was involved), and it sparked my curiosity in iOS development enough that I actually decided to set aside time to learn. And since Swift is the hot new thing with Apple, I figured I’d learn that at the same time.

This is where Udacity came in. Their course popped up while I was searching for some basic iOS tutorials. It was geared towards recording and playing back audio, which was one of the key components of our drunken idea, so I gave it a shot and was really satisfied. …

About

Alex Persian

iOS engineer @ Spotify

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store