50 iOS Interview Questions And Answers Part 4

Updated on Dec, 2023
Check out Part 1, Part 2 and Part 3 if you haven’t already :). Let’s get started.
1- What is Functional programming?
An approach of solving problems by decomposing complicated processes. The goal is avoid changing state or mutating values outside of its scope. There are three main concepts. These concepts are: separating functions and data, immutability, and first-class functions.
2- Explain Dynamic Type
Dynamic Type allows our app’s text to increase or decrease size on user’s preference improving visibility and accessibility. When the user selects one of the large accessibility sizes from setting menu. We can observe the content size category did change notification, but since iOS 10 there is a better way using trait collections UITraitCollection.
3- What is ARC and how is it different from AutoRelease?
Autorelease is still used ARC. ARC is used inside the scope, autorelease is used outside the scope of the function.
4- Explain differences between Foundation and CoreFoundation
The Foundation is a gathering of classes for running with numbers, strings, and collections. It also describes protocols, functions, data types, and constants. CoreFoundation is a C-based alternative to Foundation. Foundation essentially is a CoreFoundation. We have a free bridge with NS counterpart.
5- What’s accessibilityHint?
accessibilityHint describes the results of interacting with a user interface element. A hint should be supplied only if the result of an interaction is not obvious from the element’s label.
6- Explain place holder constraint
This tells Interface Builder to go ahead and remove the constraints when we build and run this code. It allows the layout engine to figure out a base layout, and then we can modify that base layout at run time.
7- Are you using CharlesProxy ? Why/why not ?
If I need a proxy server that includes both complete requests and responses and the HTTP headers then I am using CharlesProxy. With CharlesProxy, we can support binary protocols, rewriting and traffic throttling.
8- Explain unwind segue
An unwind segue moves backward through one or more segues to return the user to a scene.
9- What is the relation between iVar and @property?
iVar is an instance variable. It cannot be accessed unless we create accessors, which are generated by @property. iVar and its counterpart @property can be of different names.
iVar is always can be accessed using KVC.
10- Explain UNNotification Content
UNNotification Content stores the notification content in a scheduled or delivered notification. It is read-only.
11- What’s the difference between Android and iOS designs?
- Android uses icons, iOS mostly uses text as their action button. When we finish an action, on Android you will see a checkmark icon, whereas on iOS you’ll have a ‘Done’ or ‘Submit’ text at the top.
- iOS uses subtle gradients, Android uses flat colors and use different tone/shades to create dimension. iOS uses bright, vivid colors — almost neon like. Android is colorful, but not as vivid.
- iOS design is mostly flat, but Android’s design is more dimensional. Android adds depth to their design with floating buttons, cards and so on.
- iOS menu is at the bottom, Android at the top. Also a side menu/hamburger menu is typically Android. iOS usually has a tab called ‘More’ with a hamburger icon, and that’s usually the menu & settings rolled into one.
- Android ellipsis icon (…) to show more options is vertical, iOS is horizontal.
- Android uses Roboto and iOS uses San Francisco font
- Frosted glass effect used to be exclusive to iOS, but you’ll see a lot of them in Android too nowadays. As far as I know it’s still a hard effect to replicate in Android.
- Android usually has navigation button in color, whereas iOS is usually either white or gray.
12- What is Webhooks ?
Webhooks allow external services to be notified when certain events happen within your repository. (push, pull-request, fork)
13- Explain difference dependency injection and inject dependencies
Using dependency injection for a view model or view controller is easy enough, but to inject dependencies into every view on-screen would be significant work and a lot more lines of code to manage.
14- Explain CAEmitterLayer and CAEmitterCell
UIKit provides two classes for creating particle effects: CAEmitterLayer and CAEmitterCell. The CAEmitterLayer is the layer that emits, animates and renders the particle system. The CAEmitterCell represents the source of particles and defines the direction and properties of the emitted particles.
15- Why do we need to specify self to refer to a stored property or a method When writing asynchronous code?
Since the code is dispatched to a background thread we need to capture a reference to the correct object.
16- Explain NSManagedObjectContext
Its primary responsibility is to manage a collection of managed objects.
17- Explain differences between service extension and content extension
The service extension lets us the chance to change content in the notification before it is presented. The content extension gives us the tools, we have in an app to design the notification.
18- Explain CustomStringConvertible and its difference from CustomDebugStringConvertible
We can use custom string description of our objects implementing the CustomStringConvertibleprotocol and adding a new computed property called description
CustomDebugStringConvertible provides additional information about our objects, for debugging purposes.
19- What is intrinsic content size?
Intrinsic content size represents the amount of space a view needs to display its content. Every view that contains content can calculate its intrinsic content size. The intrinsic content size is calculated by a method on every UIView instance. This method returns a CGSize instance. For example, the intrinsic content size of a UILabel will be the size of the text it contains.
20- What is Instruments?
Instrument is a powerful performance tuning tool to analyze that performance, memory footprint, smooth animation, energy usage, leaks and file/network activity.
21- What is Deep Linking?
Deep linking is a way to pass data to your application from any platform like, website or any other application. By tapping once on link, a specific page to be opened within the application.
There are two ways to add DeepLink in Swift:
- Universal Link; it is the way to launch applications from the website.
- URL Scheme; it is first deeplink type in Swift. Unlike Universal Link, URL Scheme does not need SSL.
22- What is Optional Binding ?
We are going to take optional value and we are going to bind it non optional constant. We used If let structure or Guard statement.
23- Explain super keyword in child class
We use the super keyword to call the parent class initializer after setting the child class stored property.
24- Explain Polymorphism
Polymorphism is the ability of a class instance to be substituted by a class instance of one of its subclasses.
25- Explain In-app Purchase products and subscriptions
- Consumable products: can be purchased more than once and used items would have to re-purchase.
- Non-consumable products: user would be able to restore this functionality in the future, should they need to reinstall the app for any reason. We can also add subscriptions to our app.
- Non-Renewing Subscription: Used for a certain amount of time and certain content.
- Auto-Renewing Subscription: Used for recurring monthly subscriptions.

26- What is HealthKit ?
HealthKit is a framework on iOS. It stores health and fitness data in a central location. It takes in data from multiple sources, which could be different devices. It allows users to control access to their data and maintains privacy of user data. Data is synced between your phone and your watch.
27- What is Protocol?
A protocol defines a blueprint of methods, properties and other requirements that suit a particular task or piece of functionality. The protocol can then be adopted by a class, structure, or enumeration to provide an actual implementation of those requirements. Protocol provides us with some opportunities, such as preventing code reusability, enabling polymorphism, implementing delegate patterns. Also Protocols can inherit from other protocols in a similar way to classes inheriting from superclasses.
The Swift Programming Language Guide by Apple
28- Explain tokenization
Tokenizing a string denotes splitting a string with respect to a delimiter. Check this example usage for Swift.
29- Explain libssl_iOS and libcrypto_iOS
These files are going to help us with on device verification of our receipt verification files with In-App purchases.
30- Explain JSONEncoder and JSONDecoder in Swift4
Decodable protocol, which allows us to take data and create instances of our object, populated with the data passed down from the server.
Encodable protocol to take instances of our object and turn it into data. With that data, we can store it to the files, send it to the server, whatever you need to do with it.
31- What is CocoaTouch ?
CocoaTouch is a library used to build executable applications on iOS. CocoaTouch is an abstract layer on the iOS.
32- What is NotificationCenter ?
NotificationCenter is an observer pattern, The NSNotificationCenter singleton allows us to broadcast information using an object called NSNotification.
The biggest difference between KVO and NotificationCenter is that KVOtracks specific changes to an object, while NotificationCenter is used to track generic events.
33- Why is inheritance bad in swift?
- We cannot use superclasses or inheritance with Swift value types.
- Upfront modelling
- Customization for inheritance is an imprecise
For more information check this out
34- Explain Sequence in Swift
Sequence is a basic type in Swift for defining an aggregation of elements that distribute sequentially in a row. All collection types inherit from Sequence such as Array, Set, Dictionary.
35- What is Receipt Validation ?
The receipt for an application or in-app purchase is a record of the sale of the application and of any in-app purchases made from within the application. You can add receipt validation code to your application to prevent unauthorized copies of your application from running.
36- Explain generic function zip(_:_:)
According to the swift documentation, zip creates a sequence of pairs built out of two underlying. That means, we can create a dictionary includes two arrays.
37- Explain Inversion-of-Control
Inversion of Control is a design principle which is achieved using dependency injection.
Inversion of control principle says that create the dependencies first and then create the instance of the entity than inject them through initializers setter methods protocols or some other way. However entities should be injected them from outside this helps us in following the single responsibility principle of the solid concept makes our code loosely coupled and eventually easily testable.
38- Explain OptionSet
Option sets are similar to enums, but OptionSet designs to work more than one at a time. We can say enums are an exclusive state, OptionSet is an inclusive state. For creating an OptionSet, there is one requirement which is the rawValue the property of integer type, and an initializer. Option sets aren’t collections.
39- Explain subscripts
Subscripts are analogous to methods. Classes, structures, and enumerations can define subscripts, which are shortcuts for accessing the member elements of a collection, list, or sequence.
40- What is Strategy Pattern?
Strategy pattern allows you to change the behaviour of an algorithm at run time. Using interfaces, we are able to define a family of algorithms, encapsulate each one, and make them interchangeable, allowing us to select which algorithm to execute at run time. For more information check this out.
41- What is an “app ID” and a “bundle ID” ?
A bundle ID is the identifier of a single app. For example, if your organization’s domain is xxx.com and you create an app named Facebook, you could assign the string com.xxx.facebook as our app’s bundle ID.
An App ID is a two-part string used to identify one or more apps from a single development team. You need Apple Developer account for an App ID.
42- What is Factory method pattern?
The Factory Method pattern is a creational pattern that provides an interface for creating objects. For more information check this out.
43- What is CoreSpotlight?
CoreSpotlight allows us to index any content inside of our app. While NSUserActivity is useful for saving the user’s history, with this API, you can index any data you like. It provides access to the CoreSpotlight index on the user’s device.
44- What are layer objects?
Layer objects are data objects which represent visual content and are used by views to render their content. Custom layer objects can also be added to the interface to implement complex animations and other types of sophisticated visual effects.
45- Explain AVFoundation framework
We can create, play audio and visual media. AVFoundation allows us to work on a detailed level with time-based audio-visual data. With it, we can create, edit, analyze, and re-encode media files. AVFoundation has two sets of API, one that’s video, and one that is audio.
46- What’s the difference between accessibilityLabel and accessibilityIdentifier?
accessibilityLabel is the value that’s read by VoiceOver to the end-user. As such, this should be a localized string. The text should also be capitalized. Because this helps with VoiceOver’s pronunciation. accessibilityLabel is used for testing and Visual Impaired users.
accessibilityIdentifier identifies an element via accessibility, but unlike accessibilityLabel, accessibilityIdentifier's purpose is purely to be used as an identifier for UI Automation tests. We use a value for testing process.
47- How to find the distance between two points (1x, 1y and 2x, 2y)?
We need to calculate the distance between the points, we can omit the sqrt() which will make it a little faster. This question’s background is Pythagorean theorem. We can find the result with CGPoint.
p1
|\
| \
| \ H
| \
| \
|_ _ _\
p248- Explain Property Observer
A property observer observes and responds to changes in a property’s value. With property observer, we don’t need to reset the controls, every time attributes change.
49- Explain the difference between Generics and AnyObject in Swift
Generics are type safe, meaning if you pass a string as a generic and try to use as a integer the compiler will complain and you will not be able to compile your. Because Swift is using Static typing, and is able to give you a compiler error.
If you use AnyObject, the compiler has no idea if the object can be treated as a String or as an Integer. It will allow you to do whatever you want with it.
50- Explain Encoding, Decoding and Serialization, Deserialization
Serialization is the process of converting data into a single string or json so it can be stored or transmitted easily. Serialization, also known as encoding. The reverse process of turning a single string into a data is called decoding, or deserialization. In swift we useCodable protocol that a type can conform to, to declare that it can be encoded and decoded. It’s basically an alias for the Encodable and Decodable protocols.
That’s it. 😃😃😃 Thanks for reading. I hope all these questions will help you in your interviews. Part 5 is ready.
If you want to follow me in social media, here are some links: github, twitter, instagram






