Sign in

S -> Single responsibility principle
your class should be specialised to play just one role.

O -> Open-closed principle
your class, modules, functions should be open for extension and closed for modification.

L -> Liskov Substitution Principle
your object should be replaceable by the instance of its subclass without altering the correctness of the program.

I -> Interface Segregation Principle
you should not make your class to implement interfaces that they do not use. eg: Therefore you create multiple protocols to implement this principle.

D -> Dependency Inversion Principle
your code should not depend on a concrete classes. They do not need all the knowledge. There should be abstraction but not concretion.
eg: you create protocol to handle this scenario.

reference:
https://www.raywenderlich.com/21503974-solid-principles-for-ios-apps


Why does my app crash?

  • CPU can not execute your code.
  • Operating system terminates your app processes.
  • Programming language is preventing failure.
  • Developer is preventing failure.

How to access crash logs?

  • Crash log file is uploaded to the app store with users consent.
  • sign In to Xcode
  • upload app symbols (when necessary so that crash log becomes readable)
  • these crash log is then accessible from Xcode organizer
  • you can click 'Open in Project..' to see the crash in your code.

Analysing some of the crash logs

  • SIGILL : this indicates illegal instruction. CPU was trying to execute an instruction which is invalid or that does not exist. We get line…

task handover explanation

Grand Central Dispatch (GCD) also known as Dispatch is a low-level API provided by Apple in order to manage the concurrent operations of multicore processors in macOS, iOS, watchOS, and tvOS.

Concurrency — Multiple threads are executed at the same time parallelly (depending on the availability of the system threads).

GCD manages the shared thread pool underneath in order to manage tasks.

Queues -
1. GCD operates on Dispatch queues — a class called ‘DispatchQueue’.
2. Queues can be Serial or Concurrent. Serial queue guarantees that only one task is executed at a given time. A concurrent queue allows multiple tasks…


Closures are self-contained blocks of functionalities that can be passed around in your code.

closure expression syntax

{ 
(parameters) -> (return type) in
(body)
}

Trailing closure

When you pass a closure as a function's last argument.

func someFunction(arg1: Type, closure: (parameters) -> closureReturn) { 
// some code
}

eg:

func getElements(for id: Int, completion completionBlock: ([Int]) -> Void) { 
// some logic
}

which will called as below
getElements(for: 1) { (elements) in
// handle logic
}

Closure capture values that are passed to it

suppose,

let closures = { (val) in
print("I like " + val)
}
func example() {
var value = "Cats"
closures(value)
value = "Dogs"…

AnkitaVK

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store