More Related Content
Similar to 20171004 kotlin rls_hosaka
Similar to 20171004 kotlin rls_hosaka (20)
20171004 kotlin rls_hosaka
- 2. はじめに
• 保坂 駿(ほさか しゅん)
• 新卒1年目、Kotlin歴3年目
• GitHub, Qiitaなど : /Reyurnible
• キッズリーというプロダクトのPO兼エンジニア
(保育園向けのサービス)
2
- 10. モックデータのインジェクション
10
/**
* Create Article
*/
val articleFactory = Kodein.Module {
constant("now") with Date()
bind<List<Article>>() with factory { size: Int ->
(0 until size).map {
instance<Article>()
}
}
bind<Article>() with provider {
Article(
title = "Samsung tried to spin the Note 7 disaster",
description = "From time to time, Samsung strikes...",
author = "Brian Heater",
url = "https://example.com/2017/08/24/",
urlToImage = "https://example.com/image.png",
publishedAt = instance("now")
)
}
}