Answer Posted / iosraj
As per Apple's Docs
Initialization is the process of preparing an instance of a class, structure, or enumeration for use. This process involves setting an initial value for each stored property on that instance and performing any other setup or initialization that is required before the new instance is ready for use.
You implement this initialization process by defining initializers, which are like special methods that can be called to create a new instance of a particular type. Unlike Objective-C initializers, Swift initializers do not return a value. Their primary role is to ensure that new instances of a type are correctly initialized before they are used for the first time.
Initializers
Initializers are called to create a new instance of a particular type. In its simplest form, an initializer is like an instance method with no parameters, written using the init keyword:
init() {
// perform some initialization here
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain grand central dispatch (gdc).
What is protocol in swift?
How should errors be handled in swift?
What is the full meaning of swift?
What is floating point number in swift? What are the different floating point numbers in swift?
What is the characteristics of switch in swift?
Explain the common execution states for a swift ios app (ios application lifecycle).
Why we use lazy in swift?
Who calls the main function of our app during the app launch cycle?
What is swift programming?
Explain enum in swift.
How to convert nsmutablearray to swift array in swift?
How long does it take to learn swift?
What language is swift most similar to?
What are the features of swift programming?