ios questions Flashcards
How could you set up Live Rendering?
The attribute @IBDesignable lets Interface Builder perform live updates on a particular view. IBDesignable requires Init frame to be defined as well in UIView class.
What is the difference between Synchronous & Asynchronous task?
Synchronous: waits until the task have completed
Asynchronous: completes a task in the background and can notify you when complete
Explain Compilation Conditions
Compilation Conditions to use if DEBUG … endif structure to include or disable given block of code ve separate targets.
What is made up of NSError object?
There are three parts of NSError object a domain, an error code, and a user info dictionary. The domain is a string that identifies what categories of errors this error is coming from.
What is Enum or Enumerations?
Enum is a type that basically contains a group of related values in the same umbrella but case-less enum won’t allow us to create an instance.
What is the bounding box?
The smallest rectangle completely containing all points in a path
Why don’t we use strong for enum property in Objective-C?
Because enums aren’t objects, so we don’t specify strong or weak here.
What is @synthesize in Objective-C?
synthesize generates getter and setter methods for your property.
What is @dynamic in Objective-C?
We use dynamic for subclasses of NSManagedObject. @dynamic tells the compiler that getter and setters are implemented somewhere else.
Why do we use synchronized?
synchronized guarantees that only one thread can be executing that code in the block at any given time.
What is the difference strong, weaks, read only and copy?
strong, weak, assign property attributes define how memory for that property will be managed.
Strong means that the reference count will be increased and the reference to it will be maintained through the life of the object
Weak ( non-strong reference ), 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.
Every time used on var
Every time used on an optional type
Automatically changes itself to nil
Read-only, we can set the property initially but then it can’t be changed.
Copy means that we’re copying the value of the object
when it’s created. Also prevents its value from changing
What is Dynamic Dispatch?
Dynamic Dispatch is the process of selecting which implementation
of a polymorphic operation that’s a method or a function to call at run time. This means, that when we wanna invoke our methods like object method. but Swift does not default to dynamic dispatch
What’s Code Coverage?
Code coverage is a metric that helps us to measure the value of our unit tests.
What’s Completion Handler?
Completion handlers are super convenient when our app is making an API call, and we need to do something when that task is done, like updating the UI to show the data from the API call. We’ll see completion handlers in Apple’s APIs like dataTaskWithRequest and they can be pretty handy in your own code.
The completion handler takes a chunk of code with 3 arguments:(NSData?, NSURLResponse?, NSError?) that returns nothing: Void. It’s a closure.
The completion handlers have to marked @escaping since they are executed some point after the enclosing function has been executed.
How to Prioritize Usability in Design ?
Broke down its design process to prioritize usability in 4 steps:
Think like the user, then design the UX.
Remember that users are people, not demographics.
When promoting an app, consider all the situations in which it could be useful.
Keep working on the utility of the app even after launch.
What’s the difference between the frame and the bounds?
The bounds of a 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 a UIView is the rectangle, expressed as a location (x,y) and size (width, height) relative to the superview it is contained within.
What is Responder Chain ?
A ResponderChain is a hierarchy of objects that have the opportunity to respond to events received.
What is Regular expressions?
Regular expressions are special string patterns that describe how to search through a string.
What is Operator Overloading?
Operator overloading allows us to change how existing operators behave with types that both already exist. Operators are those little symbols like +, *, and /
What is TVMLKit?
TVMLKit is the glue between TVML, JavaScript, and your native tvOS application.
What is Platform limitations of tvOS?
First, tvOS provides no browser support of any kind, nor is there any WebKit or other web-based rendering engine you can program against. This means your app can’t link out to a web browser for anything, including web links, OAuth, or social media sites.
Second, tvOS apps cannot explicitly use local storage. At product launch, the devices ship with either 32 GB or 64 GB of hard drive space, but apps are not permitted to write directly to the onboard storage.
tvOS app bundle cannot exceed 4 GB.