Meesho | IOS | SDE3 | Bangalore | Dec 2021 | Not Selected
Anonymous User
1964

Status: Working as SSE in a Multinational Product Based company.
YOE: 8.5 years In IOS 2.5 years

Round 1: IOS - 90 Minutes

  • Schedule for 90 minutes but lasted for 60 minutes around below question he asked
  • Why swift over objective c?
  • Why Swift is called protocol oriented language?
  • Output for the below code?
DispatchQueue.main.async {
	print("A")
	DispatchQueue.main.sync {
		print("B")
	}
	print("C")
}

Answer: 
Output is: A because to print C it will wait main.sync should come out it will create deadlock in real time it will crash but it will give output in playofround as A
  • Diff b/w String? Vs String! - 
  • Let name: String = "abc" // Answer: This will compile

Let name: String = nil // Answer: This will not compile

Let name: String? = nil // Answer: This will compile

Let name: String! = nil // Answer: This will compile

  • Question releated to ARC
  • Need to give answer it will compile or not if yes then why and if no then why?
  • Will you be able to make an object of the class?
Struct Person {
	let name: String
	let father: Person
}

class Person {
	let name: String
	let father: Person

	init(name: String, person: Person) {
		self.name = name
		self.person = person
	}
}

Answer: 
Struct will not complie and Class will complie you can create object of Class because of Referance type.

Let’s say on a VC there are many UI elements?
Task is to design a function which will return all the UILabels on that VC?

Main View

  • V, I, L, L, T, V, I

  • V, , L, L, I, T

-V
	- V
		-V
			-L
	-I
	
	-V
		-L
	-T
	
	Answer:
 extension UIView {	
	func findLabel(inout output: [ULabel]){	
		for innerView in self.subviews {
			If innerView as UIView {
				output.append(contentsOf: innerView.findLabel())	
			} else if innerView as UILabel {
				output.append(innerView)
			}	
		}
		return output
	}
}


view.findLabel(&[])
Comments (3)