iOS project evolution

This is a text version of my talk @ CocoaHeads Kazakhstan from Decemebr 2022

Since 2021 I have been a part of inDrive, and to be more specific - on city-to-city travel feature of the app, where people can find and create long-distance car rides. I wanted to tell a story of how the product I'm working at is Version 3.0, why Version 1.0 had been online for so long, and meanwhile, what happened to Version 2.0?

Swift 🧑 Server

Swift was introduced in 2014 by Apple to replace Objective-C as the main programming language for all the Apple's platforms. It's fast, powerful, secure, and very beginner-friendly. Half a year later it was open sourced, so it was a matter of time when it would be ported to other platforms. Besides iOS, iPadOS, macOS, tvOS and watchOS it's officially supported on Linux and Windows. It even works on Android, but with some tweaks, you can read about it on Swift's official GitHub repo.

However, you can't really make much on these platforms besides some scripts and CLI programs. That is because a language is only a part of a code base. The other part is a User Interface framework. We have UIKit for mobile, AppKit for macOS and of course SwiftUI for both. Actually, there is a platform which does not require a UI framework. What is it?

How I revived my old MacBook (again)

By the end of 2020 I was still rocking a mid-2012 MacBook Pro as a personal machine. Waiting on those M2 chips, really, I'm a little skeptical of the overall success of M1 considering the fact that every first generation of an Apple product is usually followed by a much better product generation. iPhone 3G outlived the original iPhone, iPad2, which I was a proud owner of for a long time, was officially supported by Apple for way more than that thick first gen iPad. Thus, it was my prediction that M1, while being a huge success for Apple, would be followed by M2, even more powerful chip. So that's my excuse.

Value & Reference types in Swift

There are two categories a type in Swift can fall into:

  • Value Type
  • Reference Type

An instance of a Value type makes and keeps a unique copy of an original element. When the original element changes, the change does not affect the created copy. An instance of a Reference type, however, creates a reference, and it shares a single copy with the original element. This way, when the original element changes, it affects all the existing references.

Now in English!

When I first started this blog I was writing about everything I found interesting, mostly programming and internet stuff. Eventually it transitioned into a basic programmer's blog with tutorials and nothing more. That's boring even to me, and I'm writing all this! Besides, I haven't posted in a while because I couldn't think of anything interesting to write a tutorial about.

That's why I decided to freshen things up a little bit and changed one little detail - I will now be writing in English. I don't think I have many (any) readers, especially English-speakers, so it's pretty much for myself.

UIKit-ΠΏΡ€ΠΎΠ΅ΠΊΡ‚ Π±Π΅Π· Storyboard

Π‘ΠΎΠ·Π΄Π°Π½ΠΈΠ΅ UIKit-ΠΏΡ€ΠΎΠ΅ΠΊΡ‚Π° Π±Π΅Π· использования Storyboard Π² ΠΏΠ΅Ρ€Π²Ρ‹ΠΉ Ρ€Π°Π· каТСтся Ρ‡Π΅ΠΌ-Ρ‚ΠΎ слоТным, Π½Π° самом ΠΆΠ΅ Π΄Π΅Π»Π΅ основныС ΠΏΡ€ΠΎΠ±Π»Π΅ΠΌΡ‹ ΠΏΡ€ΠΈ ΠΏΠΎΠΏΡ‹Ρ‚ΠΊΠ΅ Π·Π°ΠΏΡƒΡΡ‚ΠΈΡ‚ΡŒ ΠΏΡ€ΠΎΠ΅ΠΊΡ‚ Π±Π΅Π· сторибордов ΠΌΠΎΠ³ΡƒΡ‚ ΠΏΠΎΡΠ²ΠΈΡ‚ΡŒΡΡ ΠΏΡ€ΠΈ Π½Π΅ΠΏΡ€Π°Π²ΠΈΠ»ΡŒΠ½ΠΎΠΌ установкС, ΡƒΠ΄Π°Π»Π΅Π½ΠΈΠΈ Π½Π΅Π½ΡƒΠΆΠ½Ρ‹Ρ… Ρ„Π°ΠΉΠ»ΠΎΠ² ΠΈ зависимостСй.

Navigation history stack (iOS 14)

Одно ΠΈΠ· Π½Π΅Π·Π½Π°Ρ‡ΠΈΡ‚Π΅Π»ΡŒΠ½Ρ‹Ρ…, Π½ΠΎ ΠΏΠΎΠ»Π΅Π·Π½Ρ‹Ρ… Π½ΠΎΠ²ΠΎΠ²Π²Π΅Π΄Π΅Π½ΠΈΠΉ - "история" Π² Π½Π°Π²ΠΈΠ³Π°Ρ†ΠΈΠΈ. Π§Ρ‚ΠΎΠ±Ρ‹ Π²Π΅Ρ€Π½ΡƒΡ‚ΡŒΡΡ Π½Π° Π½Π°Ρ‡Π°Π»ΡŒΠ½Ρ‹ΠΉ экран Navigation Controller Ρ€Π°Π½ΡŒΡˆΠ΅ приходился Π½Π°ΠΆΠΈΠΌΠ°Ρ‚ΡŒ "Π½Π°Π·Π°Π΄" ΡΡ‚ΠΎΠ»ΡŒΠΊΠΎ Ρ€Π°Π·, сколько потрСбуСтся, Π½ΠΎ Π² iOS 14 Π΅ΡΡ‚ΡŒ Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡ‚ΡŒ Π²Ρ‹Π±Ρ€Π°Ρ‚ΡŒ ΠΎΠΏΡ€Π΅Π΄Π΅Π»Ρ‘Π½Π½Ρ‹ΠΉ экран Π² Ρ†Π΅ΠΏΠΎΡ‡ΠΊΠ΅, ΠΏΠΎ ΠΊΠΎΡ‚ΠΎΡ€ΠΎΠΉ ΠΌΡ‹ ΠΏΡ€ΠΈΡˆΠ»ΠΈ ΠΊ Ρ‚Π΅ΠΊΡƒΡ‰Π΅ΠΌΡƒ, Π° Ρ‚Π°ΠΊΠΆΠ΅ Π²Π΅Ρ€Π½ΡƒΡ‚ΡŒΡΡ Π½Π° ΠΏΠ΅Ρ€Π²ΠΎΠ½Π°Ρ‡Π°Π»ΡŒΠ½Ρ‹ΠΉ экран ΠΎΠ΄Π½ΠΈΠΌ Π΄Π²ΠΈΠΆΠ΅Π½ΠΈΠ΅ΠΌ.

На ΠΏΠ΅Ρ€Π²Ρ‹ΠΉ взгляд полСзная ΡˆΡ‚ΡƒΠΊΠ°, ΠΏΡ€ΠΎ ΠΊΠΎΡ‚ΠΎΡ€ΡƒΡŽ ΠΏΠ΅Ρ€Π²ΠΎΠ΅ врСмя придётся Π²ΡΠΏΠΎΠΌΠΈΠ½Π°Ρ‚ΡŒ, ΠΎΠ΄Π½Π°ΠΊΠΎ Π΅ΡΡ‚ΡŒ ΠΎΠ΄Π½Π° ΠΏΡ€ΠΎΠ±Π»Π΅ΠΌΠ°. Π‘ΠΎΠ²Ρ€Π΅ΠΌΠ΅Π½Π½Ρ‹Π΅ Π΄ΠΈΠ·Π°ΠΉΠ½Ρ‹ часто ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΡŽΡ‚ ΠΊΠ½ΠΎΠΏΠΊΡƒ "Π½Π°Π·Π°Π΄" Π±Π΅Π· тСкста, ΠΈΠ·-Π·Π° Ρ‡Π΅Π³ΠΎ мСню с историСй выглядит пустым.

Нонконформизм Π² соврСмСнной iOS-Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ΅ (a.k.a. Π― Ρ€Π΅ΡˆΠΈΠ» ΠΏΠΎΠ·Π½Π°ΠΊΠΎΠΌΠΈΡ‚ΡŒΡΡ с Objective-C)

TL;DR: Π― написал простоС ΠΏΡ€ΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅ Π½Π΅ Objective-C, Ρ‡Ρ‚ΠΎΠ±Ρ‹ ΡƒΠ·Π½Π°Ρ‚ΡŒ Π΅Π³ΠΎ ΠΏΠΎΠ±Π»ΠΈΠΆΠ΅ ΠΈ Π»ΡƒΡ‡ΡˆΠ΅ ΠΏΠΎΠ½ΠΈΠΌΠ°Ρ‚ΡŒ ΠΏΡ€ΠΈΠΌΠ΅Ρ€Ρ‹, написанныС Π½Π° Π½Ρ‘ΠΌ. Оказалось, Swift позаимствовал ΠΌΠ½ΠΎΠ³ΠΎ Ρ‚Π΅Ρ€ΠΌΠΈΠ½ΠΎΠ², ΠΈΠ·-Π·Π° Ρ‡Π΅Π³ΠΎ Obj-C Π³ΠΎΡ€Π°Π·Π΄ΠΎ понятнСС, Ρ‡Π΅ΠΌ каТСтся.