You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+70-13Lines changed: 70 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -139,15 +139,19 @@ A common occurence in MVC is where you have a massive-view-controller (some joke
139
139
140
140
A protocol defines a list of required and optional methods for a class that adopts the protocol to implement. Any class is allowed to implement a protocol so that other classes can send message to it based on the protocol methods without knowing the type of class. An example of how a protocol is defined:
A common instance protocols are used is providing a DataSource for UITableView or UICollectionView ([source](https://www.codementor.io/mattgoldspink/ios-interview-tips-questions-answers-objective-c-du1088nfb))
152
156
153
157
#### What is waterfall methodology and Agile methodology? What are the differences between them?
@@ -208,9 +212,14 @@ Sometimes it is necessary it capture self in a block such as when defining a cal
208
212
209
213
Instead, capturing a weak reference to self is recommended in order to avoid this issue:
210
214
211
-
```
215
+
<details open>
216
+
<summary>Objective-C</summary>
217
+
218
+
```objective-c
212
219
SomeBlock* __weak weakSelf = self;
213
220
```
221
+
</details>
222
+
214
223
215
224
#### What is memory management handled on iOS?
216
225
@@ -269,13 +278,15 @@ Blocks are a language-level feature of Objective (C and C++ too). They are objec
269
278
270
279
The syntax to define a block literal uses the caret symbol(^):
271
280
272
-
```
273
-
281
+
<details open>
282
+
<summary>Objective-C</summary>
283
+
284
+
```objective-c
274
285
^{
275
286
NSLog(@"This is an example of a block")
276
287
}
277
-
278
288
```
289
+
</details>
279
290
280
291
#### What is the difference between category and extension in Objective-C?
281
292
@@ -307,10 +318,14 @@ Classes have capabilities that structs do not:
307
318
308
319
When referring to something as implicit or explicit, it is often referring to how an object is declared. In the two examples below:
309
320
310
-
```
321
+
<details open>
322
+
<summary>Swift</summary>
323
+
324
+
```swift
311
325
var name: String="onthecodepath"// explicit
312
326
var name ="onthecodepath"// implicit
313
327
```
328
+
</details>
314
329
315
330
In the first line above, the name variable is *explicitly* declared since the type of the variable follows the name of the variable. In the second line, the String type is not explicitly declared. However, Swift is able to infer that name is of a String type since the value that it is being set as is of a String type.
316
331
@@ -343,11 +358,33 @@ Tasks executed *serially* are executed one at a time while tasks that are execut
@@ -366,20 +403,40 @@ Tasks executed *serially* are executed one at a time while tasks that are execut
366
403
);
367
404
}
368
405
```
406
+
</details>
407
+
<br>
369
408
370
409
All UI updates must be performed on the main thread. Global dispatch queues do not make any guarantees so code should be modified to run the UI update on the main thread. Here is the fix below:
0 commit comments