improve AttrsWithContentBuilder functions

This commit is contained in:
InsanusMokrassar 2022-05-19 18:56:52 +06:00
parent 67a6998f02
commit 53b020ab8d

View File

@ -8,8 +8,12 @@ import org.w3c.dom.Element
typealias AttrsWithContentBuilder<T> = Pair<Attrs<T>, ContentBuilder<T>> typealias AttrsWithContentBuilder<T> = Pair<Attrs<T>, ContentBuilder<T>>
@Suppress("NOTHING_TO_INLINE") @Suppress("NOTHING_TO_INLINE")
inline fun <T : Element> AttrsWithContentBuilder(noinline builder: ContentBuilder<T>) = AttrsWithContentBuilder( inline fun <T : Element> AttrsWithContentBuilder(
Attrs.empty(), vararg modifiers: UIKitModifier?,
noinline attrs: AttrsScope<T>.() -> Unit = {},
noinline builder: ContentBuilder<T>
) = AttrsWithContentBuilder(
Attrs(*modifiers, attrs = attrs),
builder builder
) )
@ -18,15 +22,6 @@ inline fun <T : Element> AttrsWithContentBuilder(attrs: Attrs<T>) = AttrsWithCon
attrs attrs
) {} ) {}
@Suppress("NOTHING_TO_INLINE")
inline fun <T : Element> AttrsWithContentBuilder(
modifier: UIKitModifier?,
vararg modifiers: UIKitModifier?,
noinline attrs: AttrsScope<T>.() -> Unit = {}
) = AttrsWithContentBuilder(
Attrs(modifier, *modifiers, attrs = attrs)
)
inline val <T : Element> AttrsWithContentBuilder<T>.attrs inline val <T : Element> AttrsWithContentBuilder<T>.attrs
get() = first get() = first