Really awesome, tried to add the new artifacts and...
# compose
i
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 😁.
Copy code
//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
Wait the artifacts works now?
i
yeah, worked like a charm 🙂
used these
l
Why an image! Why? 😂
😂 3
i
It's simpler to send 😆, sry
l
Those 2 are still empty
i
Copy code
implementation("androidx.ui:ui-core:0.1.0-dev01")
implementation("androidx.ui:ui-layout:0.1.0-dev01")
implementation("androidx.ui:ui-framework:0.1.0-dev01")
implementation("androidx.ui:ui-material:0.1.0-dev01")
implementation("androidx.ui:ui-foundation:0.1.0-dev01")
implementation("androidx.ui:ui-text:0.1.0-dev01")
here
l
Thanks 🙂
f
Oh my god we can just use those now?
What happens if you use @Composable?
l
It works
f
But what about the compiler plugin?
l
Not necessary? 😧
f
We know they are using a compiler plugin
You sure you didn’t add anything other than those deps?
l
Android Studio 3.5.1 Build #AI-191.8026.42.35.5900203, built on September 25, 2019 JRE: 1.8.0_202-release-1483-b49-5587405 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.14.6
Using this AS, no, new project, just those lines
p
I still wonder where we are going to write Business Logic 🧌
l
in functions 😉
p
I am gonna pretend I buy that.
😂 1
f
In flutter you just always execute callbacks outside of the UI
Copy code
Button(onClick = ::businessesLogic)

//...
fun businessLogic(){
}
Is there anything missing here? Obviously usually method reference is not what you would do
p
They promoted BLOC pattern at some point. I kind of like it. Is a very Streamish/functional approach.
l
🤷🏼‍♂️
k
@themishkun you might be interested in this 🧵. ☝️
t
@kioba thanks for summoning me, finaly I can deprecate my half-backed prebuilts. But I think that we still need to use custom AS, am i right?
f
It seems the answer is you are wrong
>> Android Studio 3.5.1
Build #AI-191.8026.42.35.5900203, built on September 25, 2019 JRE: 1.8.0_202-release-1483-b49-5587405 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.14.6
i
I'm using AS 3.6 beta01, and it's working
Only added the gradle dependencies
f
I remember it working in normal android studio when I had the source on windows
So now that we have binaries...
i
Oh, and I'm on Windows 10 also
f
Great milestone for windows users :)
i
Yeah, definitely 😁
l
I’m running mac OS with the above version of AS 🙂
t
Nice.jpg And code highlighting/linting also works flawlessly?
e g will it turn red when you'll try to call compose function out of composition scope?
i
Working fine
l
hey folks, just chiming in here… i think that code might be “working” in that it compiles, but is actually subtly wrong for various reasons. You’re welcome to play around with it in this way, but expect certain things to not work as expected… /me walks away slowly
😂 12
i
no IDE warning, should have on MaterialTheme (composable outside composable context)
l
Expect apps shipped with compose from today 😄
🤡 1
🤐 2
👌 3
r
We’re still changing APIs, possibly in drastic ways so… your problem 🙂
a
Are you trying to tell me that version "0.1.0-dev01" doesn't mean ship to production?
😂 5
😥 1
l
it’s confusing, we know
d
Sick!
kotlin-reflect
is also required for now.
l
Does it work with coroutines?
r
No. The compiler backend still has issues.
l
Does this implictly add a dependency to a special Kotlin version? How can this work seemingly without any plugin?
l
it doesn’t work. that’s what we’re trying to tell you 🙂
l
Yes, I understood it doesn't work with coroutines, but I see people telling compose itself works, and I'm curious how as I thought it'd need a new Kotlin version and maybe other stuff.
l
no that’s what i mean. the code that is up on gmaven will not work if you just try and run it like the top of this thread is saying
it will compile, but it is not correct without our plugin running, which requires a special version of kotlin
l
Oh okay! That makes sense. @Icaro Temponi So you're just playing with the syntax, but it doesn't run, right?
i
No, it worked, I could even change the text of a Text composable using a Button and state.
Strange
Though I didn't try anything more complex.
I got an app I work on and just overrode the onCreate from the main activity, adding the snippet above. Apart from adding the dependencies I just did that and it worked.
Just to make shure, I created a new project on GitHub to test if it was really working without a custom AS version or a gradle plugin and looks like it's indeed working: https://github.com/icarohs7/unox-compose-playground Screenshot from the basic application:
l
yeah, simple apps like this might work. still though, this is subtly not 100% correct and more complicated code will fail. so… all at your own’ risk kinda thing