Ilker Furkan Kahyalar

Ilker Furkan Kahyalar

Software Engineer







TIL - 14 January 2021

Hello everyone! Let’s take a look what I learned in 14 January 2021, shall we?

#1 - Default values in Swift compiler-generated initializers


When you create a struct, unless you explicitly define an init method, the compiler will generate one for you based on the properties of your struct.

Nothing new, right. But what if we want to gave a default value to a variable in the struct?

struct Pizza {
  let name: String
  let ingredients: [Ingredient]
  private(set) var extras: [Ingredient] = []

private(set) access control mitigates the mutable state risk: only the code internal to the struct can change the value of extras.

#2 - TDD Circle


In 2021, I want to add TDD and Unit Testing in my skillset. So, I was searching a bit to understand more about TDD and its three steps: Red, Green, Refactor

I found this image that explains a lot for me:

  1. Write a failing test
  2. Make your code passes the test
  3. Refactor your code

#3 - .reduce()


I saw this small hint on Twitter by Tibor Bödecs which transforms your array game to next level:

From this:

let numbers = [1, 2, 3, 4, 5]

var sum = 0
for number in numbers {
  sum += number

To this:

let numbers = [1, 2, 3, 4, 5]

let result = numbers.reduce(0, +)

Simply amazing.

Other Findings

  1. One of my favourite blogger/writer, Gergely Orosz’s YouTube channel
  2. Revisiting the iOS Skills Matrix by Bohdan Orlov

Closing Notes

I hope you liked what you heard and I am really looking forward to seeing you in the next one!

  • Keep up to date and follow on Instagram. DMs are always welcome! 🔥

  • You can reach out to me via Contact Form, Email and social media icons in the left. 💌

Buy Me A Coffee

Until next one,