Skip to content

Commit

Permalink
refactor: replace inline fun to avoid reflection
Browse files Browse the repository at this point in the history
  • Loading branch information
adrielcafe committed Feb 21, 2022
1 parent f33b095 commit e0d727e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ public object ScreenRegistry {
factories[T::class] = factory as ScreenFactory
}

public inline fun <reified T : ScreenProvider> get(provider: T): Screen {
val factory = factories[T::class] ?: error("ScreenProvider not registered: ${T::class.qualifiedName}")
public fun get(provider: ScreenProvider): Screen {
val factory = factories[provider::class]
?: error("ScreenProvider not registered: ${provider::class.qualifiedName}")
return factory(provider)
}
}

0 comments on commit e0d727e

Please sign in to comment.