https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
compose
  • r

    Robert Menke

    09/06/2019, 1:17 AM
    I went through this tutorial tonight on using a MVVM (model, view, viewmodel) architecture with SwiftUI and Combine tonight https://www.raywenderlich.com/4161005-mvvm-with-combine-tutorial-for-ios. Very compelling way to build apps. Decouples the UI from the state nicely in a redux/vuex kind of way while being 100% reactive and declarative with minimal boilerplate. I’d love to see something similar with Compose/Coroutines once it’s released 🙂
    v
    a
    • 3
    • 5
  • b

    BMG

    09/06/2019, 6:54 AM
    Extending the above point, Flutter has a lot of state management "choices" and there was not really a recommended way to manage state until last Google IO where speakers recommended something called
    Provider
    (https://pub.dev/packages/provider) pattern. Would you guys prefer/recommend any specific state management technique for Compose when it gets released?
    a
    • 2
    • 1
  • k

    kioba

    09/08/2019, 5:31 PM
    Composing
    Wrap
    and
    Container
    result in a 0 sized child. is this the expected behavior?
    f
    m
    • 3
    • 19
  • v

    voddan

    09/09/2019, 6:08 AM
    Hm, that smells to me like a potential problem with the api. It is always confusing when different parts of a dsl are executed at different times. I had a lot of trouble with gradle for that reason.
    a
    • 2
    • 2
  • p

    Paul Woitaschek

    09/10/2019, 10:50 AM
    I’d love to see some monthly summaries on medium what’s happening on compose and what are the approaches / directions, compose is taking
    👍 29
    k
    a
    +3
    • 6
    • 7
  • t

    themishkun

    09/10/2019, 12:42 PM
    Yeah, but some kind of nightly builds would be even more awesome!
    k
    • 2
    • 2
  • k

    kioba

    09/16/2019, 6:15 PM
    I just listened to the benchmark episode on the backstage podcast and there was a brief mention of compose and the benchmark lib. Can you tell us a little about these tests? Also about that insight you learned?
    👍🏼 3
    ➕ 1
    l
    m
    +2
    • 5
    • 14
  • g

    gpaligot

    09/17/2019, 9:17 AM
    Any highlight about app architecture with Jetpack Compose? We’ll stay with MVVM+LiveData or something new like Flutter and their “block” architecture?
    k
    l
    +4
    • 7
    • 20
  • a

    Andrey Danilov

    09/18/2019, 9:47 PM
    I tried animations in Compose and met one serious problem - I really didnt find easy way to set animation time. What about adding
    duration
    to
    fun <T> Transition
    function for example?
    d
    p
    • 3
    • 5
  • a

    alexsullivan114

    09/27/2019, 1:25 PM
    Do you still have to setup the androidx toolchain to test out compose? I thought I read about it being available in pre-alpha stages through the normal development process but I could be wrong.
    l
    s
    t
    • 4
    • 7
  • t

    themishkun

    09/27/2019, 9:10 PM
    Is compose dev branch broken? I get an error message when trying to run
    uploadArchives
    to install latest compose in local maven repo. I’m trying to build commit dcc1de2983b53d51988bef191cbea7a722edaf08
    err.log
    j
    • 2
    • 1
  • a

    Ash

    10/04/2019, 3:22 AM
    Love SwiftUI / Combine Framework where UI is a function of state ... Never going back to UIKit. Seeing Compose feel like removing XML, RecyclerView, PagingLib, ViewModel, Room etc ... whenever possible. Thank you for building Jetpack compose in opensource so I can follow the evolution. I am tempted to release all my apps on Compose with Kotlin Flow.
    g
    g
    +7
    • 10
    • 20
  • a

    Adam Powell

    10/04/2019, 8:25 PM
    Text(text = "Hello, world!", modifier = padding(16.dp))
    😢 1
    k
    • 2
    • 6
  • r

    Ruckus

    10/04/2019, 8:28 PM
    I'm not familiar with Flutter, so may I ask what that gives you over
    Padding(16.dp) { Text(text = "Hello, world!") }
    a
    a
    +4
    • 7
    • 59
  • d

    dewildte

    10/05/2019, 12:06 PM
    I wish Kotlin had support for custom operators like F# lol.
    r
    a
    +3
    • 6
    • 9
  • j

    jim

    10/09/2019, 3:50 PM
    @alexsullivan114 Perhaps I can speak to that one, as I was one of the engineers building React.js at Facebook and was also the person who designed it differently when I proposed building Compose at Google. Creating real views during every composition would be prohibitively expensive. Just as creating HTML elements in browsers can be expensive (although this is improving dramatically in recent years), creating Views on Android is not cheap. To recreate a real view hierarchy on every update would be a non-starter. React and Flutter both use a VirtualDOM, and your `render`/`build` functions return VDOM elements. This worked, and was a relatively revolutionary design decision at the time, and their continued success is a testament to this model. I considered a similar approach for Compose. However, there were a few drawbacks to this approach. 1. Performance. Although the VDOM is orders of magnitude faster than creating real DOM/Views, modern view frameworks are highly optimized, and the VDOM allocations and garbage collection become bottlenecks. Furthermore, creating new VDOM elements means the VDOM elements are no longer referentially equal, which makes them more expensive to compare in the common case where the particular node doesn't change, which becomes the second performance bottleneck. Our approach makes it possible to avoid the allocations (present day) and comparisons (future work), which should allow us to achieve a better performance profile once we start optimizing aggressively (we're still just getting everything working at this point). Furthermore, VDOM makes it harder to statically reason about hierarchy invariants, which make it harder to do some more advanced compile-time optimizations. 2. Readability. The VDOM encouraged a bunch of patterns that made the code less maintainable. For example, users would build up VDOM trees, pass them around, and use them as input to other functions that would return modified VDOM. I personally consider these patterns to be antipatterns, and the Compose style takes them completely off the table because you don't get access to the VDOM elements, so you can't abuse them. 3. Control Flow Ergonomics. Because you need to produce/return VDOM elements, doing control flow becomes awkward. If you want to iterate over nested lists, then you either need to have
    list.map { it.map { ... }}
    or you need to create a mutable list with nested
    for
    loops that mutate the list. Those approaches are both perfectly doable, but not super ergonomic. The Compose method ends up handling
    if
    statements and
    for
    loops in a more natural way. To be clear, other declarative frameworks like React, Flutter, Vue, and Ember are great frameworks, so please don't take the above as a criticism of them. The various frameworks have different constraints and environments, and these decisions are all just a series of tradeoffs. We as an ecosystem are still learning and experimenting and iterating. We opted to do more work at compile time instead of at runtime with a VDOM, which has both pros and cons. Hopefully we will find that the pros outweigh the cons in our environment, but only time will tell.
    👍 27
    a
    • 2
    • 2
  • m

    Mark Murphy

    10/10/2019, 1:11 PM
    What's the story behind the
    0.1.0-dev01
    Jetpack Compose artifacts that landed in the Google Maven repo? The
    androidx.compose
    ones seem to be empty, and the
    androidx.ui
    ones transitively depend on the empty
    compose-runtime
    one. 🧐
    🚀 3
    🎉 2
    😱 7
    l
    s
    d
    • 4
    • 10
  • a

    Ash

    10/11/2019, 12:11 AM
    https://developer.android.com/dev-summit/schedule/day1 11:20 -12:00 on October 23 What's New in Jetpack Compose Adam Powell, Clara Bayarri, Romain Guy Jetpack Compose was announced at Google I/O and the team has been hard at work ever since. This talk introduces Compose to new audiences, including what the project is and how it is taking shape. The talk also updates people who already know about Jetpack Compose, including how the project has evolved. ~ So excited I am not sure I can sleep the night before 🎄 ... camping out to be first in line ... LOL
    👀 5
    a
    l
    r
    • 4
    • 22
  • i

    Icaro Temponi

    10/11/2019, 2:55 PM
    Really awesome, tried to add the new artifacts and render a Hello, World! view and omg, didn't even need to apply a plugin, it just worked, and this hook-like syntax using destructuring for the state is so concise, I'll start playing with this rn 😁.
    //MainActivity.kt
    setContent {
        val (text, setText) = +state { "Hello, World!" }
        MaterialTheme {
            Column(modifier = padding(8.dp)) {
                Text(text = text)
                Button(text = "Click me", onClick = { setText("Button Clicked!") })
            }
        }
    }
    l
    f
    +8
    • 11
    • 62
  • t

    Tristan Caron

    10/11/2019, 3:01 PM
    I think this question has been already answered, but I am gonna ask it again 😄 Why
    val (text, setText) = +state { "Hello, World!" }
    And not
    var text by State("Hello, World!")
    Same questions for
    @Composable
    actually
    @Composable
    fun MyComponent() {}
    Instead of
    fun MyComponent = composable { }
    Maybe I should wait for an article about this?
    f
    l
    +4
    • 7
    • 37
  • i

    Icaro Temponi

    10/11/2019, 6:38 PM
    How can I create a Compose Image from a Bitmap? found this function
    fun imageFromResource(res: Resources, resId: Int): Image
    to create one from a resource and noticed that it uses an
    AndroidImage
    class that does exactly what I need, but it's internal. Is there a way to do this right now? Or should we copy paste the class or create our implementation of Image what uses a Bitmap?
    a
    k
    • 3
    • 3
  • y

    Yang

    10/14/2019, 3:20 AM
    Spotted ConstraintLayout in Compose: https://android-review.googlesource.com/c/platform/frameworks/support/+/1137175
    🤔 1
    l
    l
    +2
    • 5
    • 18
  • l

    Leland Richardson [G]

    10/14/2019, 8:15 PM
    most/all core components will accept modifiers as far as I understand it, but not all have been refactored to do so yet
    ➕ 4
    f
    g
    +3
    • 6
    • 17
  • l

    Leland Richardson [G]

    10/14/2019, 8:15 PM
    but making a Padding composable for yourself to use is pretty trivial
    l
    • 2
    • 1
  • s

    Siyamed

    10/15/2019, 6:42 AM
    Which one is more kotliner: A “Builder” object functions should (1️⃣return this ) or (2️⃣let me use with/apply etc and don’t return this)
    2️⃣ 16
    1️⃣ 2
    e
    l
    m
    • 4
    • 20
  • t

    themishkun

    10/15/2019, 10:10 AM
    Just saw in some sample floating online that compose needs
    kapt
    and
    kotlin.reflect
    now. Will it be permanent requirements or a subject to change?
    m
    a
    l
    • 4
    • 10
  • i

    Icaro Temponi

    10/16/2019, 11:11 AM
    With compose will there be any use case for fragments (compose only projects)?
    s
    • 2
    • 1
  • r

    romainguy

    10/16/2019, 7:59 PM
    Try
    ./gradlew studio
    a
    l
    • 3
    • 3
  • a

    Akram

    10/17/2019, 12:33 PM
    Hey just a question why the compose runtime is using the kotlin multiplatform plugin are they planning to make the library multiplatform ?
    🦀 1
    f
    t
    +3
    • 6
    • 7
  • t

    Tash

    10/17/2019, 9:01 PM
    Just tried out the dev artifacts to build a simple app with compose for the first time using MVI. It’s so seamless, intuitive, and makes reasoning about UI flow way simpler 😻 .Just wanted to say thanks to the team 🙏🏻 . Excited to use it more.
    ➕ 2
    🎉 12
    j
    t
    • 3
    • 5
Powered by Linen
Title
t

Tash

10/17/2019, 9:01 PM
Just tried out the dev artifacts to build a simple app with compose for the first time using MVI. It’s so seamless, intuitive, and makes reasoning about UI flow way simpler 😻 .Just wanted to say thanks to the team 🙏🏻 . Excited to use it more.
➕ 2
🎉 12
j

jim

10/17/2019, 9:15 PM
Just please be aware that it won't have the correct semantics without the proper toolchain. It might look like it's doing the right thing, but you will encounter subtle/infuriating bugs if you don't have the right toolchain, as mentioned here: https://www.reddit.com/r/androiddev/comments/dggpqy/jetpack_compose_binaries_are_now_available_to/f3bktsf/
🙏 2
t

Tash

10/18/2019, 1:28 AM
That makes sense, set up my environment accordingly.
t

tjohnn

10/18/2019, 3:42 PM
Can you share your code repo? @Tash
t

Tash

10/18/2019, 8:16 PM
@tjohnn needed to clean it up a bit. here it is https://github.com/drinkthestars/pizza-flow
t

tjohnn

10/18/2019, 8:35 PM
Thanks for sharing
👍 1
View count: 3