When you would like to create constant in Swift there are many ways to do that. Which one is the best depends on your taste. The most important thing about the constant is the fact the you cannot change its value.

In this article I would like to present a way I am mostly creating constant and a way I am using them.

Most of the time I’m creating constant in the extension of a type of given constant. For example when I would like to create UIImage constant I am doing something like this:

I would like to…

If you are working with closure based NSNotification’s implementation, you have to deal with returned `tokens`. The simplest way to store reference to them is to keep them in a property:

Situation complicates when we have to store more than one token.
We can solve it by keeping references in the array:

If we wouldn’t like to create temporary constants willEnterForegroundToken didBecomeActiveToken, there are at least two ways to solve it.

Let’s start with more obvious one:

I leave it to you to judge this implementation. I would like to share with you another way to handle…

Long, long time ago (a couple of years ;)) I was reading a book called Design Patterns: Elements of Reusable Object-Oriented Software. I was a young software developer then and I really liked that book. But there was a problem. I wasn’t able to use its potential because I didn’t have enough experience to know how to use those pattern correctly.

Recently I heard a lot of comments that some people after reading that book start using most of those pattern in any place they think they could use it. This is of course wrong. When you are young developer…

At the beginning I would like to mention that this topic is the most important one from my list of things I would like to share and write about. This concept is not exclusive to iOS developers and I think all of us who write more code than just “hello world” should be familiar with it.

Let’s dive in.

How to pollute your code with external dependency? There is a simple answer for that: just use it everywhere! Answering that we can do something more interesting.

Firstly I would like to present short theoretical concept I will use in this…

Today’s post should be really simple and short. It’s my second post ever and I truly believe that posts should be short and consistent to encourage the reader to dive into the content.
Let’s start!

In most of projects I’m working on, I’m not using storyboards. I’m familiar with them, I know how to use them, I see and understand their strong and weak parts. Knowing these facts I still prefer to write my projects using code only.

When we are working with UICollectionView one of the first things we have to do is to register our subclass of UICollectionViewCell:

This is my first blog post ever, that’s why I would like to quickly introduce myself. My name is Adrian Śliwa and I’m an iOS applications developer. During my several years of iOS experience I always wanted to be up to date with iOS concepts. Recently I discovered an incentive inside myself to start sharing my ideas and thoughts of iOS applications development. That’s why I’m here writing my first blog post for you. I hope you will enjoy it.
So let’s start.

On October 27, 2017 Chris Eidhof released his post about Micro Auto Layout DSL: http://chris.eidhof.nl/post/micro-autolayout-dsl/. I was…

Adrian Śliwa

iOS applications developer working on various kinds of projects. Recently discovering an incentive to share his knowledge with other fellows.

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