Photo by Lukas Blazek on Unsplash

Since we make lots of important decisions by looking at the analytics data (if not, you should), I will not go into “why” having accurate analytics data is extremely important.

You probably also know that it is extremely painful to manually test if analytics events are being reported correctly. It’s very time consuming to perform some actions in the app, wait for the analytics tool to receive these events and verify each. Now, multiply this with number of releases you’ll have in the future… It’s a nightmare. 😩

This time could be better spent elsewhere.

Any time you have this…

Photo by Mikael Kristenson on Unsplash

Originally published on Swift Post.

Functional Reactive Programming (FRP) is almost an industry standard on mobile today. If you’re not familiar with it, here’s a great read by Daniel Lew on fundamentals. In the first part, he explains the difference between passive and reactive components. I find this really interesting. I think we should talk more about what it means to be reactive before diving into any implementation. In this post, we will repeat his switch-lightbulb experiment, then try to reflect the learnings on component design.

Photo by Julian Howard on Unsplash

Originally published on Swift Post.

Codable got everyone excited because we all love parsing JSON and it’s nice to have this tool as a part of the standard library. Now it’s time to test if it’s worthy enough to be our favorite one.

Let’s see how Codable performs under rough conditions. We’re going to parse the following JSON using Codable and then compare it against the popular Unbox/Wrap implementation.

“placeName”: “İstanbul, Turkey”,
“lat”: 41.0049823,
“lon”: 28.7319958,
“dateAdded”: “2018-05-25”,
“info”: “İstanbul is a very historical city.”

We want our data model to look like the following.

struct Place: Codable…

Photo by Markus Spiske on Unsplash

Originally published on Swift Post.

If you have been developing mobile apps for a while, you’ve probably heard of MVVM and VIPER. While some people say MVVM does not scale well, some others say VIPER is an overkill. I am here to explain why I think they are very similar and we don’t even need to separate the two.

Let’s first quickly go over MVVM and VIPER.

What is MVVM?

An alternative to delegation and NotificationCenter

Photo by Milivoj Kuhar on Unsplash

Originally published on Swift Post.

Apple frameworks use delegation and observer pattern (NotificationCenter) heavily to pass information around. Although there is nothing wrong about these patterns, the actual implementation always looked a bit inconsistent to me.

Let’s look at the basic traits of these patterns first:

  • Delegation: Supports 1-to-1, two-way communication.

Photo by Max Bender on Unsplash

I was trying to build a URL the other day. Check the following code block:

init?(userId: String?) {
guard userId != nil else { return nil }

self.path = "/user/\(userId)"

Seems legit, right?

Assume that we’re passing 23940 as userId to this initializer. Depending on the Swift version, path value would be:

Swift 2.x | path = "/user/23940"
Swift 3.x | path = "/user/Optional("23940")"
Swift 4.x | path = "/user/Optional("23940")"

Subtle, but heart-breaking.

Firstly, beware of this issue if you’re working on a super-old project which still uses Swift 2.x for some reason, and planning to migrate.


Photo by Max Bender on Unsplash

I was planning to write “short” and simple articles about my findings from day-to-day Swift experiments for a while now… 🕵

Here goes the first lightning article! 🚀

Problem: Intermediate clutter that comes with map, flatMap and filter functions

Let’s say we have the following requirements in an imaginary project:

There are 6 frames for an animation in format animation_<index>.jpeg available to download.

- Download animation frames using Request objects.

- Discard every second frame for better performance.

In a real world, we would most probably have more frames but think of this as a simplified example.

Instead of using a for loop for these 6 frames, we will go functional…

Understanding architectures to the core…

Bahá’í Temple of South America

In the last two years, I’ve had chances to experiment with architectures like MVC, MVVM and VIPER. What’s common among those is the V component, which represents the views in our application. In a perfect world, view component should only do the following:

  • Delivers any user action (touches) to business layer.
  • Listens for state changes and updates itself.

Nothing else. Unlike their differences, view component is actually the same in all architectures. It is dumb, isolated and therefore easily replaceable.

But honestly, are they? Look at any of your implementations and tell me… In most iOS applications, they are actually…

Subtle best practises that Swift developers are keeping secret.

When I first started iOS development, I was always curious about best practises used by giant companies. How does their project structure look like? What architecture are they using? Which third party libraries are the most popular? This was my urge to build upon other people’s experience and don’t waste time on problems that are already solved.

It has been 4 years since. I worked with many clients and had many smart people on my team to discuss about these coding practises. …

This is a hard problem in any language. When we are interacting with APIs, we are constantly making requests on objects. Let’s say we have an object x. If we say x.doSomething(), this will create a new state on this object. We can only assume what parts of x is changed as a result of doSomething function, by looking at the method name or documentation. And this assumption may fail at any time, for example, with a newer version of the API. This means, with every move, we are creating side effects in the system and we just don’t care…

Göksel Köksal

iOS developer. Serious gamer.

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