Member-only story

50 Swift Interview Questions and Answers

Ace your iOS developer job interview by knowing the answers to these essential questions

Artturi Jalli
Better Programming
14 min readApr 30, 2021

--

Original Image: Charles Deluvio

Here’s a list of 50 Swift interview questions and answers. These questions focus on Swift programming and iOS app development. You need to know the answers to these before you get a chance to show your skills in front of a job interviewer.

These questions are in no particular order — let’s get right into it!

1. What Causes an Error? How Can You Fix It?

let n1: Int = 1
let n2: Float = 2.0
let n3: Double = 3.34
var result = n1 + n2 + n3

Answer:

In Swift, implicit type casting between two data types is not possible.

In the code above, you’re trying to add three elements together, each of which represents a different data type.

To fix this, you need to convert each value to the same data type. For example:

var result = Double(n1) + Double(n2) + n3

2. What is the Value of Len? Why?

var arr1 = [1, 2, 3]
var arr2 = arr1
arr2.append(4)var len = arr1.count

--

--

No responses yet

What are your thoughts?