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


Download 0.71 Mb.
Pdf ko'rish
bet12/27
Sana09.10.2023
Hajmi0.71 Mb.
#1696547
1   ...   8   9   10   11   12   13   14   15   ...   27
Bog'liq
0b951f3e909d09b66eb8f74930008ded79a64d5e79248dc67824bd9e2aadd4fa

Reference Types: When you copy a reference type, the data is shared
among all instances. The reference is copied, but the data it refers to is not.
When one is altered, the other is altered as well.
13. Name the JSON framework which is supported by iOS.
Page 15
© Copyright by Interviewbit


Swi Interview Questions
iOS supports the SBJson framework. The SBJson framework adds more control and
flexibility to the JSON handling process. It is a well designed and extremely adaptable
framework that allows APIs (Application Programming Interfaces) to function in a
variety of ways. SBJSON is one of the many open-source JSON parsers or generators
created with Objective-C. These allow you to use JSON easily when coding Objective-
C apps.
14. What is the use of the "mutating" keyword in ios Swi ?
Ios Swi structs are immutable since they are of the value type. Other variables, for
example, cannot modify the values of structure at any point in time. Only the
"mutating" keyword is necessary to change the values of self variables within the
function of the structure. Let us take the following code snippet for example:
We get a compile-time error when we try to alter the value of variable "foo" inside a
function declared in the struct itself.
As a result, we will need to create a mutating function to update the value inside the
structure. As a result, the correct code is:
struct demoStruct { 
var foo: String = "Initial String" 
mutating func transformString() { 
foo = "Transformed String".

}
15. What do you understand about protocols in ios Swi ?
Page 16
© Copyright by Interviewbit
struct demoStruct { 
var foo: String = "Initial String" 
func transformString() { 
foo = "Transformed String".
//The above results in a compile time error: Cannot assign to property: 'self' is immut
//We need to mark the method 'mutating' to make 'self' mutable. 

}



Download 0.71 Mb.

Do'stlaringiz bilan baham:
1   ...   8   9   10   11   12   13   14   15   ...   27




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