How to specify the layout of elements in UIView?
We can use InterfaceBuilder by adding a set of XIB file to the project with the layout elements inside of it. Next, we have to load the XIB in the application code. This process can be done both manually and automatically. With InterfaceBuilder, we can also create a storyboard for the application.
We can write our own code to use NSLayoutConstraints and in a view arranged by Auto Layout, we can have other components.
What JSON framework does the iOS supports?
In general, iOS supports SBJson framework. It is a JSON generator and parser for an Objective-C programming language. Objective C is used when we need to write software for iOS and OS X. It is a superset of the C programming language and known for its dynamic runtime and object-oriented abilities.
SBJson also provides applicable application programming interface and extra control, by which we can control JSON easily.
Explain the function of managed object context.
- Life-cycle management is very important as it provides the context for validation and handling inverse relationships.
- Notifications are all about the context posts notifications at different points that can be monitored from elsewhere in the application.
- When we use thread or serialized queue confinement to safeguard managed objects that coexist with managed object contexts.
Explain Dynamic Dispatch.
If we want to opt the implementation of a polymorphic operation that is called dynamic dispatch that is used as a method or a function to be called at runtime. But usually, the Swift application does not turn default to dynamic dispatch.
Describe the Memento Pattern.
The externalized Memento state when we do develop iOS operating system can be restored without violating the encompassing process, so the private data stays private. Archiving is also another specialized implementation of Apple. So as for the State, Restoration procedure iOS uses the Memento pattern.
Explain the memory management process of iOS.
The Swift application makes use of Automatic Reference Counting (ARC). And now ARC keeps the trail of strong references to instances of classes and in turn do the math and enhances or decreases their reference count in accord with the process of whether or not we should assign the instances of classes to properties, variables and constants. It simply de-stuffs the memory that is used by objects whose reference count may drop to zero. ARC, in fact, does not do the work of increasing or decreasing the reference count of value types, because these are imitated.
Distinguish between Delegate and KVO?
Although both Delegate and Key-Value Observing (KVO) are ways to have established relationships between objects, Delegation is always defined as an one-to-one relationship where one object executes a delegate protocol and we can send messages by using it in an assumption that those methods are applied since the receiver is trusted to consensually agree to the protocol.
But KVO works on the basis of the many-to-many relationship where one singleton object could display a message and one or several other objects can express the reaction seamlessly. KVO does not solidly depend upon protocols. For the block of reactive programming like RxSwift and ReactiveCocoa KVO is the first step.
What does it make NSError object up?
Error code, a domain, and a dictionary of user info are the basic parts of the NSError object that are an The domain is usually a string that figures out the categories of errors and the origin of those errors.
What Are B-Trees and how does it work?
If we look forward to an ordered key-value store with good performances, B-trees is the best choice to make. In fact, each node manages a differentiated array of its own components and yet another array.
Explain Completion Handler?
When our application is making an API call, Completion handlers are really convenient for the purpose. All we have to do is to update the user interface to display the data from the API call network. We can see the completion handlers in dataTaskWithRequest, Apple’s popular API.