Most common Swift interview questions

Photo by Daniel Romero / Unsplash

Here's my first compilation of the most common Swift and iOS interview questions. There'll be more, so follow me on Twitter & stay up to date.

Have fun and try to answer the questions before you check them! Don't cheat:)

What is the difference between frame and bounds?

Click to expand Frame represents size and posiotion of a view in its superview's coordinate space. Bounds represents view's coordinate system. In simple words, if you rotate the view, frame of the view will change, but bounds will stay the same.

What is the difference between var and let?

Click to expand Var defines mutable variable. Let is used to create immutable constant.

How are class and struct different from each other?

Click to expand Classes and structures are very similar to each other in many ways, but very different in foundation. Class can be inherited, struct can't. Class is a reference type, struct is a value type.

What are a value type and a reference type?

Click to expand Value type is always copied when modified, passed as an argument or assigned. Reference type is more mutable and is not copied when changed or assigned.

What copy-on-write means?

Click to expand It means that value is only copied when you try to modify it. If it is not modified, it mimics reference type and points to the same space in memory.

Wasn't so hard, was it? I'll be back with more tricky questions soon:)

Artur Gruchała

Artur Gruchała

I started learning iOS development when Swift was introduced. Since then I've tried Xamarin, Flutter, and React Native. Nothing is better than native code:)
Poland