Source Lover - GDG Korea Android, Kotlin User Groups Seoul - Contributer & Maintainer Making a new frontier of React Native X Android Granite ❤ Apps In Toss ❤
formatter: WeatherFormatter ) { / / . . . } fun main() { val cache = Cache() val httpClient = HttpClient(cache) val service = WeatherService(httpClient) val formatter = WeatherFormatter() val app = WeatherApp(service, app) }
httpClient: HttpClient) class WeatherFormatter(…) class WeatherApp( private val service: WeatherService private val formatter: WeatherFormatter ) fun main() { val cache = Cache() val httpClient = HttpClient(cache) val service = WeatherService(httpClient) val formatter = WeatherFormatter() val app = WeatherApp(service, app) } ࣻز ੑ
WeatherService(private val httpClient: HttpClient) class WeatherFormatter(…) class WeatherApp( private val service: WeatherService private val formatter: WeatherFormatter )
Cache) @Inject class WeatherService(private val httpClient: HttpClient) @Inject class WeatherFormatter(…) @Inject class WeatherApp( private val service: WeatherService private val formatter: WeatherFormatter )
cache: Cache ) @Inject class WeatherService( private val httpClient: HttpClient ) @Inject class WeatherFormatter @Inject class WeatherApp( private val service: WeatherService private val formatter: WeatherFormatter ) @DependencyGraph interface AppGraph { val app: WeatherApp } fun main() { val app = createGraph<AppGraph>().app }
into multibindings Binding types as nullable variants Binding types with different quali fi ers @Binds val Int.bind: Number @Binds @IntoSet val Int.bind: Number @Binds val Int.bind: Int? @Binds @Named("timeout") val Int.bind: Int
fun run() { val userRepo = factory.create("d3938c4891ae") } } @Inject class UserRepository( @Assisted val id: String, val httpClient: HttpClient, val db: UserDb ) { @AssistedFactory interface Factory { fun create(id: String) : UserRepository } }
Aggregation scopes Provider/Binds callables Their own extensions! @GraphExtension interface LoggedInActivityGraph { val user: User val activity: Activity } @GraphExtension interface LoggedInGraph { val user: User val loggedInActivityGraph: LoggedInActivityGraph } @DependencyGraph interface AppGraph { val loggedInGraph: LoggedInGraph }
(javac) Kapt source f i les kotlinc (Frontend and Backend) compileKotlin .class f i les javac compileJava More .class f i les HILT ࠽٘ ۄੋ javac :hiltJavaCompileDebug Even more .class f i les
(javac) Kapt source f i les kotlinc (Frontend and Backend) compileKotlin .class f i les javac compileJava More .class f i les HILT ࠽٘ ۄੋ javac :hiltJavaCompileDebug Even more .class f i les
Generated by Metro class $$MetroFactory : Factory<Cache> { constructor() companion object { fun create() : $$MetroFactory fun newInstance() : Cache } } }