Skip to content

Instantly share code, notes, and snippets.

@ShoMasegi
Created February 24, 2019 10:43
Show Gist options
  • Save ShoMasegi/a41ebd7a0b390ed71829862f5192f9f7 to your computer and use it in GitHub Desktop.
Save ShoMasegi/a41ebd7a0b390ed71829862f5192f9f7 to your computer and use it in GitHub Desktop.
Epoxy_Layout
inline fun EpoxyController.carousel(modelInitializer: CarouselModelBuilder.() -> Unit) {
CarouselModel_().apply {
modelInitializer()
}.addTo(this)
}
inline fun <T> CarouselModelBuilder.withModelsFrom(
items: List<T>,
modelBuilder: (T) -> EpoxyModel<*>
) {
models(items.map { modelBuilder(it) })
}
inline fun <T> HorizontalCarouselModelBuilder.withModelsFrom(
items: List<T>,
modelBuilder: (T) -> EpoxyModel<*>
) {
models(items.map { modelBuilder(it) })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment