Learn Swift Fundamentals by preparing for Job Interview, Questions 39 ~ 44 For Initializer

39) What is initializer?

  • Initializer is a method that constructs the object with proper default values.
swift initializer

40) What are the different types of initializers available in Swift?

  • Default
  • Customized
  • Convenience
  • Failable
  • Required
Swift has many initializers

41) What is the default initializer in Swift?

  • init is the default initializer in Swift.
Swift Default Initializers

42) What is parameterized / Custom Initializer?

  • init method with some input parameters to construct the object with custom values.
Swift Custom Initilizer

43) What is designated initializer in Swift?

44) What is convenience initializer in Swift?

  • Convenience Initializer is a kind of initializer which sets custom values for a few properties of an Object. Use convenience keyword to create convenience initializer.
  • Designated initializer must be called before setting the custom values.
Convenience Initializer

--

--

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
KD Knowledge Diet

KD Knowledge Diet

2.4K Followers

Software Engineer, Mobile Developer living in Seoul. I hate people using difficult words. Why not using simple words? Keep It Simple Stupid!