Google News
Swift Interview Questions
GCD (Grand Central Dispatch) is a low-level API for controlling several operations at the same time. This notion is employed to aid in the enhancement of application performance. This procedure is used to handle numerous jobs at once. The most relevant API for multitasking with Async and Sync programming in iOS is Grand Central Dispatch (GCD).
Dispatch Queue : The task is managed in FIFO (First In First Out) order by the Dispatch Queue. Dispatch queues are thread-safe because they can be accessed by several threads at the same time.

Concurrent :  This process has started numerous tasks at the same time but does not know when they will finish. It can be completed in whatever sequence you want. They perform one or more things concurrently at the same time. The work is finished in the order in which it was queued, not in the order in which it was completed.

Serial : A single task will be executed at a time. It is possible to use it to synchronize access to a certain resource.

Sync : After the work is completed, a synchronous function returns control to the caller.

Asynchronous : An asynchronous function returns instantly after ordering a job to begin but does not wait for it to finish.
Generic is efficient to write sensitive and reusable functions and types. It is provided in Swift 4. Most of the people use this feature to evade the risk of duplication. 'Arrays' and 'Dictionary' are also referred to generic collection. The libraries of Swift 4 are comprised of generic code.
You can add generics to a method (function) but can’t add to a variable. Understand it with an example:
func Vector3D(x: [T], y: [T], z: [T])
 {    self.xCord = x
    self.yCord = y
    self.zCord = z}
In this example, the generic created here is in a function. You can change the T with anything you want. This is how you can add generic in function.
Delegate is a design pattern, which is used to pass the data or communication between structs or classes. Delegate allows sending a message from one object to another object when a specific event happens and is used for handling table view and collection view events.
Delegates have one to one relationship and one to one communication.
The difference between Array and NSArray are given below :
* An array can hold only one type of data, whereas NSArray can hold different types of data.
* An array is a value type, whereas NSArray is an immutable reference type.
Images, Buttons, labels, text fields, and any other elements that are visible to the user within the application are called UI elements.
Optional chaining is a useful process which we can use in combination with the optional to call the methods, properties, and subscripts on the optionals and these values may or may not be nil. In this process, we may try to retrieve a value from a chain of the optional values.
* If the optional contains a value, then calling the subscript, method or property of an optional will return a value.
* If optional is nil, then calling the subscript, method and property will return nil.
The higher-order functions are given below :
Map : Transform the array contents.
Reduce :  Reduce the values in the collection to a single value.
Sort : Sorting the arrays.
Filter : Transform the array contents.
The design patterns that are used during app development are given below :
Behavioral : Memento, and Observer.
Creational : Builder, Factory, and Singleton.
Structural :  Façade, Adapter, and Decorator.
There are seven ways to unwrap an optional in swift. They are :
Guard statement : safe.
Forced unwrapping : using “!” operator, unsafe.
Optional binding : safe.
Optional pattern : safe.
Nil coalescing operator : safe.
Implicitly unwrapped variable declaration : unsafe in many cases.
Optional chaining : safe.
NSThread : It can create a low-level thread which can be started by using the “start” method.

NSOperationQueue :
It allows a pool of threads to be created and is used to execute “NSOperations” in parallel.