All the variables and constants that you allocate in Swift are stored in memory, so they get lost when users quit the app.
Persistence is saving data to a place where it can be re-accessed and retrieved upon restart of the device or app. So, that is longer than a life cycle the running app and keeps it available to the user.
UserDefaults is by far the easiest way to persist your data to your device. It’s like a dictionary that automatically saves its contents. With all that;
Reactive programming is converting everything into an event sequence. Every change in our data converted into an event that other parts of the application might be observing for. In ReactiveX, many instructions may execute in parallel and their results are later captured.
There are some mechanisms we will get used to.
Rather than calling a method, you define a mechanism for retrieving and transforming data in the form of observable to be able to subscribe to it. With subscribing, we have access to the data and the event.
An Observer subscribes to an Observable. An observable emits/sends items notifications to…
Grand Central Dispatch provides language features to support concurrency on iOS. It works with Dispacth Queue (objects) in our application.
By default, every iOS application has
Main thread is reserved for UI related tasks. And, we are able to create more custom (concurrent or serial) threads. Concurrent and serial queues help us to manage how we execute tasks.
Executes tasks one at a time.So, task 2 will not start until 100% of task 1 completed.
Clients can connect to the related server by using URL which contains;
https:// — SCHEME = specifies how to connection will happen.
* HTTP is a protocol for transferring hypertext documents on the World Wide Web. HTTPS is secure(encrypted data flow) version of HTTP.
medium.com/ — HOST = gets our request to the right computer
@vuralkaan/ — PATH = our end point
But the URL can contain below items;
Therefore, DNS will help to determine the actual IP address of the server.
Let’s say we are going to use Dog API in our application. And we have
Before you begin I highly recommend you to check ARC story.
We will begin with checking no memory leak case in closures;
The closure block is separate from the Human object and the humanClosure property has a reference to the closure block.
Since the Human object as one reference from the kaan property, we able to deallocate.
The closure block has been also deallocated due to the reference count of zero.
Now, check below case.
When an object is initialized, it is physically stored on RAM. Since the space is limited, the object should be removed when unused. The process is known as deallocation.
If the reference count reaches zero, the object is deallocated automatically by ARC.
1. When you subclass, you have to inherit all properties and methods which you may not need. Your object unnecessarily bloated.
2. When you make a lot of superclasses it becomes extremely hard to navigate between each class and fix bugs.
3. Since objects are referencing to the place in memory, if you make a copy and create a small change to it’s property, it can mess up the rest. (Mutability due to reference)
Software engineer @huawei , musician