Swi Interview Questions for Freshers List some advantages and disadvantages of using ios Swi


Download 0.71 Mb.
Pdf ko'rish
bet15/27
Sana09.10.2023
Hajmi0.71 Mb.
#1696547
1   ...   11   12   13   14   15   16   17   18   ...   27
Bog'liq
0b951f3e909d09b66eb8f74930008ded79a64d5e79248dc67824bd9e2aadd4fa

unowned references?
Ask yourself, "Am I dealing with reference types?" to see if you need to worry about
strong, weak, or unowned. If you are working with Structs or Enums, ARC is not in
charge of memory management, so you do not have to worry about defining weak or
unowned constants or variables.
In hierarchical relationships, strong references are acceptable when the parent refers
to the child, but not when the child refers to the parent. Strong references are, in
fact, the most appropriate type of reference the majority of the time.
If two instances are optionally linked, make sure one of them has a weak reference to
the other. 
When two instances are linked to the point where one cannot exist without the other,
the instance with the obligatory dependency must keep an unowned reference to the
other instance.
Page 19
© Copyright by Interviewbit


Swi Interview Questions
20. When is the usage of a set more preferable than an array in
ios Swi ?
If all of the following conditions are met, you should use a set rather than an array:
You only want to add each item once. Duplicates are never permitted in sets.
The order of the items in the collection is irrelevant to you.
You are storing Hashable types, either your own or those provided by Swi , such
as strings and integers. Hash values are used in sets to look for things quickly.
21. Show the use of "self" in a method using an example.
In Swi , the self property of an instance is a special property that holds the instance
itself. In most cases, self appears in a class, structure, or enumeration's initializer or
method. The most common use of self is in initializers when you are likely to want
parameter names that match your type's property names, such as this:
Page 20
© Copyright by Interviewbit



Download 0.71 Mb.

Do'stlaringiz bilan baham:
1   ...   11   12   13   14   15   16   17   18   ...   27




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling