Before starting this blog please refer the blog to know more about
Sometimes, we need extra control over the execution. To be able to cancel a task in GCD, create a work item:
If task is not started, then this will be canceled else task can’t be cancelled instead it will set
isCancelledvalue to true.
After we discuss about use of multithread developer might think to create a lot of queue to get better performance but thread creation comes with a cost as we discussed in part 1. …
Next top 20 1st round interview question which need to know before attending any interview.
The application life cycle constitutes the sequence of events that occurs between the launch and termination of application.
To know more about application life cycle refer blog here
which handles the absence of a value. Optional says either “there is a value, and it equals x” or “there isn’t a value at all”.
Optional is a super powered enum which has two values. …
Instead of writing code block under specific queue. You can have a block of code which can be executed on any thread
A DispatchWorkItem is a block of code that can be dispatched on any queue and therefore the contained code to be executed on a background, or the main thread. it can be written as follows
Let’s see a small example to understand how
DispatchWorkItem objects are used.
If want to know about what is thread, multi thread and how gcd works please refer my first blog here.
Another way to create thread is using operation. After you have created instances of your operations, submit the operations to OperationQueue. The OperationQueue will manage the threads and also responsible for running the operations that you have provided to it.
What is operation? An abstract class that represents the code and data associated with a single task.
Operation States:- Operation object maintain states internally to determine when it is safe to execute and also to notify external clients of the…
The most important one which every user expects include execution of demanding tasks in less time, best user experience, no frozen user interfaces, and so on. Now a days every device support multiple CPU cores to achieve this. Multiple cores allow to run multiple processes at the same time. This can be achieved by using multiple thread.
What is process? A process is a program that is running on your computer.
What is Thread? A thread is sequence of instructions that can be executed by a runtime.
What is Multi Thread application? We could say that the application is multithreaded…
Hi friends, in this blog we will discuss about how multiple projects are handled in iOS.
Earlier to Xcode 11/iOS 13, when you create a new project, some default files like AppDelegate.swift, ViewController.swift and a Main.storyboard and few other files were created but from Xcode 11 you might have noticed that along with the default files like above, a new file
SceneDelegate.swift is also created.
If you’re still confused about what is app life cycle and AppDelegate. Please read my blog application life cycle in iOS.
I hope by now you’re aware of AppDelegate, how app delegate interact to user event and app life cycle. …
SpringBoard is the standard application that manages the iPhone’s home screen. Other tasks include starting WindowServer, launching and bootstrapping applications and setting some of the device’s settings on startup
It is used to restrict parts of your app’s source code. This essentially helps for prohibiting other modules, frameworks, classes and code from using your code.
public— anyone can access, within the module, and in code that imports the module
internal— anyone can access, but only within the module (default)
fileprivate— anyone can access, but only within the current Swift file
private— only the
enclosingdeclaration can access, such as a class or struct.
The default access level in…
To make your app beautiful in any screen and orientation is a challenging task. Autolayout make it easy to support different screen sizes in your apps. First will try to understand the autolayout fundamental before learning programatic layouts. Click here to know about autolayout fundamental.
There are two ways you can write autolayout in code.
In this blog, I’l try to cover most of the things about Anchors and how to debug the layout error.
addSubviewso that view is in the hierarchy.
translatesAutoresizingMaskIntoConstraints = false
iOS Developer in walmart