KOTLIN FOR ANDROID, AS SWIFT FOR IOS

Hello viewer, You can now have our Tutorial Lessons in your android mobile device and read it offline.
Download kotlin Programming APP on PlayStore
Download Website SEO Lessons APP on PlayStore

During the latest edition of Google I / O, Mountain View announced Kotlin’s language support for Android Studio, which is particularly interesting because it extends the number of applications for Green Robotics.

However, Kotlin has another advantage, its syntax is in fact very similar to that of Swift, developers who already used it to create their own App will have no particular difficulty in switching between the two languages.

Topic: KOTLIN FOR ANDROID, AS SWIFT FOR IOS

KOTLIN FOR ANDROID, AS SWIFT FOR IOS - KOTLIN FOR ANDROID, AS SWIFT FOR IOS - KOTLIN FOR ANDROID, AS SWIFT FOR IOS - KOTLIN FOR ANDROID, AS SWIFT FOR IOS

Kotlin also presents another advantage, its syntax is in fact very similar to that of Swift , developers who were already using this to create your own app will have no particular difficulty in the transition between the two languages.

 

Kotlin is oriented toward the object-oriented programming exactly as Swift and allows you to build applications suited to any environment is compatible with the Virtual Machine for Java , such as Android.

Topic: KOTLIN FOR ANDROID, AS SWIFT FOR IOS

The points in common with the Apple solution for iOS, MacOS, and watchos TVOS are observable immediately, through simple operations such as the definition of the variables via value assignment.

Syntax in Swift and Kotlin

If Kotlin in fact there is a syntax like the following:

 

var variable= 100
variable= 20
val Constant = 100

in Swift will instead:

var Variable = 100
Variable = 20
let Constant = 100

You only notice a difference in the definition of the constants because of the use of the Val keyword in Kotlin, which becomes a let in Swift.
This is similar to type casting and in general the assignment of the type of data to associate, where the keywords are again val and let be a point away; In Swift you will then need an explicit casting in operations such as on-fly conversion of types, such as numeric to string for text printing.

Topic: KOTLIN FOR ANDROID, AS SWIFT FOR IOS

If in Kotlin you should use a syntax like the following:

 

val label = "width"
val width = 100
val widthLabel = label + width

in Swift instead:

let label = "width"
let width = 94
let widthLabel = label + String(width)

From this point of view, the use of the classes is particularly interesting, with some minor differences in the declaration. In Kotlin we have:

class Store {
    Var qtaProducts = 0
    fun descriptionProducts () =
        "In the store we have $qtaProducts in stock."
}

in swift:

Class Store {
    Var qtaProducts = 0
    func descriptionProducts () -> String {
        Return "In the store we have \ (qtaProducts) in stock."
    }
}

 

While the use phase is practically the same:

 

Store store = Shop ()
Store.qtaProducts = 100
Var descriptionChrow = shop.descriptionProducts ()

About The Author

Related posts

Leave a Reply