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 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?
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.
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.
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 Π² ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ°Π· ΠΊΠ°ΠΆΠ΅ΡΡΡ ΡΠ΅ΠΌ-ΡΠΎ ΡΠ»ΠΎΠΆΠ½ΡΠΌ, Π½Π° ΡΠ°ΠΌΠΎΠΌ ΠΆΠ΅ Π΄Π΅Π»Π΅ ΠΎΡΠ½ΠΎΠ²Π½ΡΠ΅ ΠΏΡΠΎΠ±Π»Π΅ΠΌΡ ΠΏΡΠΈ ΠΏΠΎΠΏΡΡΠΊΠ΅ Π·Π°ΠΏΡΡΡΠΈΡΡ ΠΏΡΠΎΠ΅ΠΊΡ Π±Π΅Π· ΡΡΠΎΡΠΈΠ±ΠΎΡΠ΄ΠΎΠ² ΠΌΠΎΠ³ΡΡ ΠΏΠΎΡΠ²ΠΈΡΡΡΡ ΠΏΡΠΈ Π½Π΅ΠΏΡΠ°Π²ΠΈΠ»ΡΠ½ΠΎΠΌ ΡΡΡΠ°Π½ΠΎΠ²ΠΊΠ΅, ΡΠ΄Π°Π»Π΅Π½ΠΈΠΈ Π½Π΅Π½ΡΠΆΠ½ΡΡ
ΡΠ°ΠΉΠ»ΠΎΠ² ΠΈ Π·Π°Π²ΠΈΡΠΈΠΌΠΎΡΡΠ΅ΠΉ.
ΠΠ΄Π½ΠΎ ΠΈΠ· Π½Π΅Π·Π½Π°ΡΠΈΡΠ΅Π»ΡΠ½ΡΡ
, Π½ΠΎ ΠΏΠΎΠ»Π΅Π·Π½ΡΡ
Π½ΠΎΠ²ΠΎΠ²Π²Π΅Π΄Π΅Π½ΠΈΠΉ - "ΠΈΡΡΠΎΡΠΈΡ" Π² Π½Π°Π²ΠΈΠ³Π°ΡΠΈΠΈ. Π§ΡΠΎΠ±Ρ Π²Π΅ΡΠ½ΡΡΡΡΡ Π½Π° Π½Π°ΡΠ°Π»ΡΠ½ΡΠΉ ΡΠΊΡΠ°Π½ Navigation Controller ΡΠ°Π½ΡΡΠ΅ ΠΏΡΠΈΡ
ΠΎΠ΄ΠΈΠ»ΡΡ Π½Π°ΠΆΠΈΠΌΠ°ΡΡ "Π½Π°Π·Π°Π΄" ΡΡΠΎΠ»ΡΠΊΠΎ ΡΠ°Π·, ΡΠΊΠΎΠ»ΡΠΊΠΎ ΠΏΠΎΡΡΠ΅Π±ΡΠ΅ΡΡΡ, Π½ΠΎ Π² iOS 14 Π΅ΡΡΡ Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡΡ Π²ΡΠ±ΡΠ°ΡΡ ΠΎΠΏΡΠ΅Π΄Π΅Π»ΡΠ½Π½ΡΠΉ ΡΠΊΡΠ°Π½ Π² ΡΠ΅ΠΏΠΎΡΠΊΠ΅, ΠΏΠΎ ΠΊΠΎΡΠΎΡΠΎΠΉ ΠΌΡ ΠΏΡΠΈΡΠ»ΠΈ ΠΊ ΡΠ΅ΠΊΡΡΠ΅ΠΌΡ, Π° ΡΠ°ΠΊΠΆΠ΅ Π²Π΅ΡΠ½ΡΡΡΡΡ Π½Π° ΠΏΠ΅ΡΠ²ΠΎΠ½Π°ΡΠ°Π»ΡΠ½ΡΠΉ ΡΠΊΡΠ°Π½ ΠΎΠ΄Π½ΠΈΠΌ Π΄Π²ΠΈΠΆΠ΅Π½ΠΈΠ΅ΠΌ.
ΠΠ° ΠΏΠ΅ΡΠ²ΡΠΉ Π²Π·Π³Π»ΡΠ΄ ΠΏΠΎΠ»Π΅Π·Π½Π°Ρ ΡΡΡΠΊΠ°, ΠΏΡΠΎ ΠΊΠΎΡΠΎΡΡΡ ΠΏΠ΅ΡΠ²ΠΎΠ΅ Π²ΡΠ΅ΠΌΡ ΠΏΡΠΈΠ΄ΡΡΡΡ Π²ΡΠΏΠΎΠΌΠΈΠ½Π°ΡΡ, ΠΎΠ΄Π½Π°ΠΊΠΎ Π΅ΡΡΡ ΠΎΠ΄Π½Π° ΠΏΡΠΎΠ±Π»Π΅ΠΌΠ°. Π‘ΠΎΠ²ΡΠ΅ΠΌΠ΅Π½Π½ΡΠ΅ Π΄ΠΈΠ·Π°ΠΉΠ½Ρ ΡΠ°ΡΡΠΎ ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΡΡ ΠΊΠ½ΠΎΠΏΠΊΡ "Π½Π°Π·Π°Π΄" Π±Π΅Π· ΡΠ΅ΠΊΡΡΠ°, ΠΈΠ·-Π·Π° ΡΠ΅Π³ΠΎ ΠΌΠ΅Π½Ρ Ρ ΠΈΡΡΠΎΡΠΈΠ΅ΠΉ Π²ΡΠ³Π»ΡΠ΄ΠΈΡ ΠΏΡΡΡΡΠΌ.

TL;DR: Π― Π½Π°ΠΏΠΈΡΠ°Π» ΠΏΡΠΎΡΡΠΎΠ΅ ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅ Π½Π΅ Objective-C, ΡΡΠΎΠ±Ρ ΡΠ·Π½Π°ΡΡ Π΅Π³ΠΎ ΠΏΠΎΠ±Π»ΠΈΠΆΠ΅ ΠΈ Π»ΡΡΡΠ΅ ΠΏΠΎΠ½ΠΈΠΌΠ°ΡΡ ΠΏΡΠΈΠΌΠ΅ΡΡ, Π½Π°ΠΏΠΈΡΠ°Π½Π½ΡΠ΅ Π½Π° Π½ΡΠΌ. ΠΠΊΠ°Π·Π°Π»ΠΎΡΡ, Swift ΠΏΠΎΠ·Π°ΠΈΠΌΡΡΠ²ΠΎΠ²Π°Π» ΠΌΠ½ΠΎΠ³ΠΎ ΡΠ΅ΡΠΌΠΈΠ½ΠΎΠ², ΠΈΠ·-Π·Π° ΡΠ΅Π³ΠΎ Obj-C Π³ΠΎΡΠ°Π·Π΄ΠΎ ΠΏΠΎΠ½ΡΡΠ½Π΅Π΅, ΡΠ΅ΠΌ ΠΊΠ°ΠΆΠ΅ΡΡΡ.