Source: statista.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Usage of Xamarin | |
 | |
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tweet{"created_at": "datetime.datetime(date_and_timezone)", "id": "id_of_the_tweet", "text": "Text of the tweet", "user": User{"id": "id_of_the_user", "name": "Screen Name", "screen_name": "twitter_handle", "url": "https://twitter.com/link_to_account"}, "url": "https://twitter.com/link_to_tweet"} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//One very powerful example of Generics might in combination with delegates is creation of SharedPreferences support | |
//taken from Kotlin for Android Developers by Antonio Leiva | |
class MyKotlinSharedPreference<T>(val context: Context, val name: String, val default: T) { | |
val prefs by lazy { | |
context.getSharedPreferences("default", Context.MODE_PRIVATE) | |
} | |
//operator overloading |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* With */ | |
//receives an object, and a function that will be executed as an extension function, which means that with can be used | |
//inside of a function to refere to the object, i.e. do something "with" | |
inline fun <T, R> with(receiver: T, f: T.() -> R): R = receiver.f() | |
//example | |
fun getPersonFromDeveloper(developer: Developer): Person { | |
return with(developer) { | |
Person(developerName, developerAge) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//we have class called Delegate that defines how to get and set values | |
class Delegate { | |
operator fun getValue(thisRef: Any?, property: KProperty<*>): String { | |
return "$thisRef, thank you for delegating '${property.name}' to me!" | |
} | |
operator fun setValue(thisRef: Any?, property: KProperty<*>, value: String) { | |
println("$value has been assigned to '${property.name}' in $thisRef.") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//A higher-order function is a function that takes functions as parameters, or returns a function. kotlin has the power | |
//to pass around functions | |
/* Lambdas */ | |
//by definition, lambda expressions are functions that are not declared, but passed immediately as an expression | |
//surrounded by curly braces and the body goes after -> | |
//very basic definition | |
val sum = { x: Int, y: Int -> x + y } |
NewerOlder