1- How we can differentiate between Synchronous & Asynchronous task ?
Synchronous: waits until the task has completed. It could lead to any completion handler that notify the callback about finishing of task.
Asynchronous: completes a task in background and can notify you when complete. The good example would be video streaming that happens simultaneously at the video is being played.
2- What is the difference strong, weaks, read only and copy ?
Strong : It means that the reference count will be increased and the reference to it will be maintained through the life of the object. And in otherwords we can say hold an ownership on an object and strongly held until the object got released.
Weak, It means that we are pointing to an object but not increasing its reference count. It’s often used when creating a parent child relationship. The parent has a strong reference to the child but the child only has a weak reference to the parent. And that the object got held weakly and can be let go.
Read only, we can set the property initially but then it can’t be changed.
Copy, It means that we’re copying the value of the object when it’s created. Also prevents its value from changing. And if the value gonna get changed the copied value will change without affecting the original value.
3– What’s the difference between the frame and the bounds?
The bounds of an UIView is the rectangle, expressed as a location (x,y) and size (width,height) relative to its own coordinate system (0,0).
The frame of an UIView is the rectangle, expressed as a location (x,y) and size (width,height) relative to the superview it is contained within.
4- Explain, What is Responder Chain ?
A ResponderChain is a hierarchy of objects that have the opportunity to respond to events received. When an event occurs and its not responded by object it continues in a chain from one and another.
5– Give, some advantages of swift ?
To mention some of the main advantages of Swift:
Optional Types, which make applications crash-resistant the app should not be crashed even if the null value is being passed.
Built-in error handling
Much faster compared to other languages
6- What is method swizzling in IOS?
Method Swizzling is a well known practice in Objective-C, Swift and in other languages that support dynamic method dispatching.
Using swizzling, the implementation of a method can be replaced with a different one at runtime, by changing the mapping between a specific #selector(method) and the function that contains its implementation.
To use method swizzling with your Swift classes there are two requirements that you must comply with:
The class containing the methods to be swizzled must extend NSObject
The methods you want to swizzle must have the dynamic attribute