Top 20 iOS interview Questions — Part 2

Next top 20 1st round interview question which need to know before attending any interview.

1. What is application life cycle?

  • Not Running state
  • Inactive state
  • Active state
  • Background state
  • Suspended state

To know more about application life cycle refer blog here

2. What is optional?

Optional is a super powered enum which has two values. None and Some(Wrapped), where Wrapped is an associated value of the correct data type

3. How can we create optional?

optional in swift is to add ? in front of the type e.g var name: String?

4. What are the ways to unwrap optionals?

  • Forced Unwrapping
  • Optional Binding
  • Optional chaining
  • With implicitly unwrapped optionals, using !
  • Nil coalescing operator
  • Unwrapping using higher order function

5. What is Optional Chaining?

To know more about optionals in swift read blog here

6. How can we iterate all enum cases?

7. What is Associated Values?

e.g: enum color { case blue(rgb: Int) }

To know more about enum in swift read blog here

8. What is frame and bounds?

Bounds = a view’s location and size using it’s own coordinate system

9. What happen if we change bounds?

To know more on bounds and frame read blog here

10. How can we create custom views?

  • Using Storyboard
  • Using XIB
  • Creating views programatically.

To know more on creating custom view and pros and cons read blog here

11. How can we set view size in ios?

  1. You can directly setting the frame of a view.
  2. Adding dynamism with Autoresizing mask.
  3. Positioning a view with AutoLayout

12. What is Autoresizing mask?

13. What is Intrinsic Content Size?

14. How Autolayout represent view’s intrinsic content size?

15. What is Content hugging?

Setting a larger value to this priority indicates that we don’t want the view to grow larger than its content.

16. What is Compression resistance?

Setting a higher value means that we don’t want the view to shrink smaller than the intrinsic content size

To know more about autolayout please read blog here

17. What is Fitting Size?



18. what are Access Control in Swift?

  1. open and public — anyone can access, within the module, and in code that imports the module
  2. internal — anyone can access, but only within the module (default)
  3. fileprivate — anyone can access, but only within the current Swift file
  4. private — only the enclosing declaration can access, such as a class or struct.

19. what is difference between open and public access control?

  • public classes and class members can only be subclassed and overridden within the defining module (target where they’re defined).
  • open classes and class members can be subclassed and overridden both within and outside the defining module (target where they’re defined).

To know more about access control please read blog here

20. difference between objective c and swift?

  1. which as header file and implementation file (i.e .h and .m)
  2. Objective C is a general purpose language which is considered as superset of C language it was designed in an aim of providing object-oriented capabilities.
  3. Objective C is dynamic type.
  4. Objective C is licensed under General Public License.
  5. Uses the ARC supported only within the cocoa API
  6. No support for dynamic libraries


  1. Swift is a general-purpose, high-level programming language which is highly concerned about safety, performance
  2. Easy to read and maintain.
  3. Swift is static type.
  4. Swift is apache licensed open source project.
  5. Support ARC for all APIs
  6. Dynamic libraries are supported

statically typed means that all your variables, constants, functions must have their types declared in advance

Dynamic libraries are usually shared between applications, therefore the system needs to store only one copy of the library and let different processes access

I hope you find this blog helpful. If you enjoyed it, feel free to hit the clap button below 👏 to help others find it! and follow me on Medium. Thanks for reading. ❤❤❤❤.



iOS Developer in walmart

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