Viktor G.

iOS developer

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)

As a personal machine I've (still) got a mid-2012 MacBook Pro. 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 гораздо понятнее, чем кажется.

Список контактов устройства

Задача: взять контакты пользователя из устройства и вывести их в виде таблицы. Оказалось, это довольно просто, достаточно вставить одну встроенную в Foundation библиотеку и написать один метод.