Last active
May 30, 2018 06:43
-
-
Save tmaxxdd/5444d93a4960ff85604c803687acbcc8 to your computer and use it in GitHub Desktop.
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
class GetTopics { | |
// getter method | |
operator fun getValue(thisRef: Any?, property: KProperty<*>): Array<Topic> { | |
//Here we can change implementation | |
return Array(20, { Topic("Some topic", "Some description")} ) | |
} | |
} | |
class MainActivity : AppCompatActivity() { | |
val topics: Array<Topic> by GetTopics()//delegated properties | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment