It’s so hard and useless to write clean code from scratch. First, make your code work. Then cover it with tests. Your team gets time to test your code, and you have a space to make it clean

Clean code is a result of the refactoring

Functions

Principle 1. A name…

Here is a quick introduction, along with the full articles list

Generics can be used when defining a function

// Generic functionfunc swapTwoValues<T>(_ first: inout T, _ second: inout T) {
let temp = first
first = second
second = temp
}
var firstInt = 3
var secondInt = 5
swapTwoValues(&firstInt…

Here is a quick introduction, along with the full articles list

…the more restrictive code comes to the compiler, the more performant it is at runtime

Method Dispatch is all about telling CPU where in memory it can find executable code for a particular method call

Direct Dispatch

Direct Dispatch is also…

Here is a quick introduction, along with the full articles list

In-out Parameters

Function parameters are constant by default

In-out parameters are used to modify parameter values. So, after a function returns, a variable that is passed as &variable will have the modified value

var num1 = 3
var num2 = 5

Here is a quick introduction, along with the full articles list

Automatic Reference Counting (ARC) is a compile-time mechanism that takes over memory management. This mechanism works only for objects that are stored on the heap (reference types)

Before ARC appeared, developers had to manage memory and objects lifetime manually…

Here is a quick introduction, along with the full articles list

… is all about improving the performance of value types

Copying on write is only about structures that are stored on the heap. It makes real copies of instances only when that copies are being changed

String and all…

Hi, everybody! You know, this is the first time when I’m writing an article somewhere. But it is not an article at all. It is something I’m just writing

My name is Maxim, and I love software development. Currently, I’m learning Swift and iOS. Listening to Swift by Sundell podcasts…

Maxim Krylov

Software Developer

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