1 . What is the difference SVN and Git?
- SVN relies on a centralised system for version management. It’s a central repository where working copies are generated and a network connection is required for access.
- Git relies on a distributed system for version management. You will have a local repository on which you can work, with a network connection only required to synchronise.
2 . What is the difference CollectionViews & TableViews?
- TableViews display a list of items, in a single column, a vertical fashion, and limited to vertical scrolling only.
- CollectionViews also display a list of items, however, they can have multiple columns and rows.
3 . What is Alamofire doing?
- Alamofire provides chainable request/response methods, JSON parameter and response serialization, authentication, and many other features. It has thread mechanics and execute requests on a background thread and call completion blocks on the main thread.
4 . REST, HTTP, JSON — What’s that?
- HTTP is the application protocol, or set of rules, web sites use to transfer data from the web server to client. The client (your web browser or app) use to indicate the desired action:
- GET: Used to retrieve data, such as a web page, but doesn’t alter any data on the server.
- HEAD: Identical to GET but only sends back the headers and none of the actual data.
- POST: Used to send data to the server, commonly used when filling a form and clicking submit.
- PUT: Used to send data to the specific location provided.
- DELETE: Deletes data from the specific location provided.
- REST, or REpresentational State Transfer, is a set of rules for designing consistent, easy-to-use and maintainable web APIs.
JSONSerialization class to help convert your objects in memory to JSON and vice-versa.
5 . What problems does delegation solve?
- Avoiding tight coupling of objects
- Modifying behavior and appearance without the need to subclass objects
- Allowing tasks to be handed off to any arbitrary object
6 . What is the major purposes of Frameworks?
- Frameworks have three major purposes:
- Code encapsulation
- Code modularity
- Code reuse
- You can share your framework with your other apps, team members, or the iOS community. When combined with Swift’s access control, frameworks help define strong, testable interfaces between code modules.
7 . Explain Swift Package Manager
- The Swift Package Manager will help to vastly improve the Swift ecosystem, making Swift much easier to use and deploy on platforms without Xcode such as Linux. The Swift Package Manager also addresses the problem of dependency hell that can happen when using many interdependent libraries.
- The Swift Package Manager only supports using the master branch. Swift Package Manager now supports packages with Swift, C, C++ and Objective-C.
8 . What is the difference between a delegate and an NSNotification?
- Delegates and NSNotifications can be used to accomplish nearly the same functionality. However, delegates are one-to-one while NSNotifications are one-to-many.
9 . Explain SiriKit Limitations
- SiriKit cannot use all app types
- Not a substitute for a full app only an extension
- Siri requires a consistent Internet connection to work
- Siri service needs to communicate Apple Servers.
10 . Why do we use a delegate pattern to be notified of the text field’s events?
- Because at most only a single object needs to know about the event.
11 . How is an inout parameter different from a regular parameter?
- A Inout passes by reference while a regular parameter passes by value.
12 . Explain View Controller Lifecycle events order?
- There are a few different lifecycle event
- - loadView
- Creates the view that the controller manages. It’s only called when the view controller is created and only when done programatically.
- - viewDidLoad
- Called after the controller’s view is loaded into memory. It’s only called when the view is created.
- - viewWillAppear
- It’s called whenever the view is presented on the screen. In this step the view has bounds defined but the orientation is not applied.
- - viewWillLayoutSubviews
- Called to notify the view controller that its view is about to layout its subviews. This method is called every time the frame changes
- - viewDidLayoutSubviews
- Called to notify the view controller that its view has just laid out its subviews. Make additional changes here after the view lays out its subviews.
- - viewDidAppear
- Notifies the view controller that its view was added to a view hierarchy.
- - viewWillDisappear
- Before the transition to the next view controller happens and the origin view controller gets removed from screen, this method gets called.
- - viewDidDisappear
- After a view controller gets removed from the screen, this method gets called. You usually override this method to stop tasks that are should not run while a view controller is not on screen.
13 . What is the difference between LLVM and Clang?
- Clang is the front end of LLVM tool chain ( “clang” C Language Family Frontend for LLVM ). Every Compiler has three parts .
1. Front end ( lexical analysis, parsing )
2. Optimizer ( Optimizing abstract syntax tree )
3. Back end ( machine code generation )
- Front end ( Clang ) takes the source code and generates abstract syntax tree ( LLVM IR ).
14 . What is Class?
- A class is meant to define an object and how it works. In this way, a class is like a blueprint of an object.
15 . What is Object?
- An object is an instance of a class.
16 . What is interface?
- The @interface in Objective-C has nothing to do with Java interfaces. It simply declares a public interface of a class, its public API.
17 . When and why do we use an object as opposed to a struct?
- Structs are value types. Classes(Objects) are reference types.
18 . What is UIStackView?
- UIStackView provides a way to layout a series of views horizontally or vertically. We can define how the contained views adjust themselves to the available space. .
19 . What are the states of an iOS App?
- Non-running — The app is not running.
- Inactive — The app is running in the foreground, but not receiving events. An iOS app can be placed into an inactive state, for example, when a call or SMS message is received.
- Active — The app is running in the foreground, and receiving events.
- Background — The app is running in the background, and executing code.
- Suspended — The app is in the background, but no code is being executed.
20 . What are the most important application delegate methods a developer should handle?
- The operating system calls specific methods within the application delegate to facilitate transitioning to and from various states. The seven most important application delegate methods a developer should handle are:
- Method called when the launch process is initiated. This is the first opportunity to execute any code within the app.
- Method called when the launch process is nearly complete. Since this method is called is before any of the app’s windows are displayed, it is the last opportunity to prepare the interface and make any final adjustments.
- Once the application has become active, the application delegate will receive a callback notification message via the method applicationDidBecomeActive.
- This method is also called each time the app returns to an active state from a previous switch to inactive from a resulting phone call or SMS.
- There are several conditions that will spawn the applicationWillResignActive method. Each time a temporary event, such as a phone call, happens this method gets called. It is also important to note that “quitting” an iOS app does not terminate the processes, but rather moves the app to the background.
- This method is called when an iOS app is running, but no longer in the foreground. In other words, the user interface is not currently being displayed. According to Apple’s UIApplicationDelegate Protocol Reference, the app has approximately five seconds to perform tasks and return. If the method does not return within five seconds, the application is terminated.
- This method is called as an app is preparing to move from the background to the foreground. The app, however, is not moved into an active state without the applicationDidBecomeActive method being called. This method gives a developer the opportunity to re-establish the settings of the previous running state before the app becomes active.
- This method notifies your application delegate when a termination event has been triggered. Hitting the home button no longer quits the application. Force quitting the iOS app, or shutting down the device triggers the applicationWillTerminate method. This is the opportunity to save the application configuration, settings, and user preferences.
21 . What does code signing do?
- Signing our app allows iOS to identify who signed our app and to verify that our app hasn’t been modified since you signed it. The Signing Identity consists of a public-private key pair that Apple creates for us.
22 . What is the difference between property and instance variable?
- A property is a more abstract concept. An instance variable is literally just a storage slot, like a slot in a struct. Normally other objects are never supposed to access them directly. Usually a property will return or set an instance variable, but it could use data from several or none at all.
23 . How can we add UIKit for Swift Package Manager?
- Swift Package Manager is not supporting UIKit. We can create File Template or Framework for other projects.
24 . Explain difference between SDK and Framework?
- SDK is a set of software development tools. This set is used for creation of applications. Framework is basically a platform which is used for developing software applications. It provides the necessary foundation on which the programs can be developed for a specific platform. SDK and Framework complement each other, and SDKs are available for frameworks.
25 . What is Downcasting?
- When we’re casting an object to another type in Objective-C, it’s pretty simple since there’s only one way to do it. In Swift, though, there are two ways to cast — one that’s safe and one that’s not .
- as used for upcasting and type casting to bridged type
- as? used for safe casting, return nil if failed
- as! used to force casting, crash if failed. should only be used when we know the downcast will succeed.
26 . Why is everything in a do-catch block?
- In Swift, errors are thrown and handled inside of do-catch blocks.
27 . What is Nil Coalescing & Ternary Operator?
- It is an easily return an unwrapped optional, or a default value. If we do not have value, we can set zero or default value.
28 . What kind of JSONSerialization have ReadingOptions?
- mutableContainers Specifies that arrays and dictionaries are created as variables objects, not constants.
- mutableLeaves Specifies that leaf strings in the JSON object graph are created as instances of variable String.
- allowFragments Specifies that the parser should allow top-level objects that are not an instance of Array or Dictionary.
29 . Explain subscripts?
- Classes, structures, and enumerations can define subscripts, which are shortcuts for accessing the member elements of a collection, list, or sequence.
30 . What is DispatchGroup?
DispatchGroup allows for aggregate synchronization of work. We can use them to submit multiple different work items and track when they all complete, even though they might run on different queues. This behavior can be helpful when progress can’t be made until all of the specified tasks are complete. — Apple’s Documentation
- The most basic answer: If we need to wait on a couple of asynchronous or synchronous operations before proceeding, we can use
31 . What is RGR ( Red — Green — Refactor )?
- Red, Green and Refactor are stages of the TDD (Test Driven Development).
- Red: Write a small amount of test code usually no more than seven lines of code and watch it fail.
- Green: Write a small amount of production code. Again, usually no more than seven lines of code and make your test pass.
- Refactor: Tests are passing, you can make changes without worrying. Clean up your code.
32 . Where do we use Dependency Injection?
- We use a storyboard or xib in our iOS app, then we created IBOutlets. IBOutlet is a property related to a view. These are injected into the view controller when it is instantiated, which is essentially a form of Dependency Injection.
- There are forms of dependency injection: constructor injection, property injection and method injection.
33 . Please explain types of notifications.
- There are two type of notifications: Remote and Local. Remote notification requires connection to a server. Local notifications don’t require server connection. Local notifications happen on device.
34 . When is a good time for dependency injection in our projects?
- There is a few guidelines that you can follow.
- Rule 1. Is Testability important to us? If so, then it is essential to identify external dependencies within the class that you wish to test. Once dependencies can be injected we can easily replace real services for mock ones to make it easy to testing easy.
- Rules 2. Complex classes have complex dependencies, include application-level logic, or access external resources such as the disk or the network. Most of the classes in your application will be complex, including almost any controller object and most model objects. The easiest way to get started is to pick a complex class in your application and look for places where you initialize other complex objects within that class.
- Rules 3. If an object is creating instances of other objects that are shared dependencies within other objects then it is a good candidate for a dependency injection.
35 . What kind of order functions can we use on collection types?
map(_:): Returns an array of results after transforming each element in the sequence using the provided closure.
filter(_:): Returns an array of elements that satisfy the provided closure predicate.
reduce(_:_:): Returns a single value by combining each element in the sequence using the provided closure.
sorted(by:): Returns an array of the elements in the sequence sorted based on the provided closure predicate.
- To see all methods available from
36 . What allows you to combine your commits?
37 . What is the difference ANY and ANYOBJECT?
- According to Apple’s Swift documentation:
- Any can represent an instance of any type at all, including function types and optional types.
- AnyObject can represent an instance of any class type.
38 . Please explain SOAP and REST Basics differences?
- Both of them helps us access Web services. SOAP relies exclusively on XML to provide messaging services. SOAP is definitely the heavyweight choice for Web service access. Originally developed by Microsoft.
- REST ( Representational State Transfer ) provides a lighter weight alternative. Instead of using XML to make a request, REST relies on a simple URL in many cases. REST can use four different HTTP 1.1 verbs (GET, POST, PUT, and DELETE) to perform tasks.
39 . What is you favorite Visualize Chart library?
- Charts has support iOS,tvOS,OSX The Apple side of the cross platform MPAndroidChart.
- Core Plot is a 2D plotting framework for macOS, iOS, and tvOS
- TEAChart has iOS support
40 . Which git command allows us to find bad commits?
41 . What is CoreData?
- Core data is an object graph manager which also has the ability to persist object graphs to the persistent store on a disk. An object graph is like a map of all the different model objects in a typical model view controller iOS application. CoreData has also integration with Core Spotlight.
42 . Could you explain Associatedtype?
- If you want to create Generic Protocol we can use associatedtype.
43 . Which git command saves your code without making a commit?
44 . Explain Priority Inversion and Priority Inheritance.
- If high priority thread waits for low priority thread, this is called Priority Inversion. if low priority thread temporarily inherit the priority of the highest priority thread, this is called Priority Inheritance.
45 . What is Hashable?
- Hashable allows us to use our objects as keys in a dictionary. So we can make our custom types.
46 . When do you use optional chaining vs. if let or guard?
- We use optional chaining when we do not really care if the operation fails; otherwise, we use
if let or
guard. Optional chaining lets us run code only if our optional has a value.
- Using the question mark operator like this is called optional chaining. Apple’s documentation explains it like this:
- Optional chaining is a process for querying and calling properties, methods, and subscripts on an optional that might currently be nil. If the optional contains a value, the property, method, or subscript call succeeds; if the optional is nil, the property, method, or subscript call returns nil. Multiple queries can be chained together, and the entire chain fails gracefully if any link in the chain is nil.
47 . How many different ways to pass data in Swift?
- There are many different ways such as Delegate, KVO, Segue, and NSNotification, Target-Action, Callbacks.
48 . Explain to using Class and Inheritance benefits
- With Overriding provides a mechanism for customization
- Reuse implementation
- Subclassing provides reuse interface
- Subclasses provide dynamic dispatch
49 . What’s the difference optional between nil and.None?
- There is no difference.Optional.None (.None for short) is the correct way of initializing an optional variable lacking a value, whereas nil is just syntactic sugar for .None. Check this out.
50 . What is GraphQL?
- GraphQL is trying to solve creating a query interface for the clients at the application level. Apollo iOS is a strongly-typed, caching GraphQL client for iOS, written in Swift.