The SwiftUI Tutorial has a section where they wrap...
# compose
c
The SwiftUI Tutorial has a section where they wrap their paging component and then use it from SwiftUI, each ‘view’ in the sequence is then declarative and the coordinator logic is bolted on. I want to do the equivalent in Compose. Is there a way to integrate Compose code with just standard View components? and/or an example of doing this? It would seem that the whole idea of a framework entitled Compose would be to demonstrate the creation of components that are made up of other components (like a ViewPager2).
l
so, if you want to know how to use an
old view
in
compose
, have a look at how
webview
is done
If you want to do vice-versa, you need to wait for the
@GenerateView
annotation to be completed
c
oh ok, I think that’s probably what I would need..
l
Btw, I see no point in using
Compose
inside the old Android Framework
I’d rather wait and start with small screens entirely in
Compose
c
well that’s not really what they are doing
l
Well, they need a solid base before allowing you to use
components
inside old view system
c
ok, and how would you tie them all together into a wizard? rewrite
ViewPager2
? [no snark there]
l
There are already examples of
Tabs
in compose
c
ok maybe that’s enough thanks I will look at that
l
The idea would be to have 2 components, one for the
tabs
themselves and 1 for the
content
both built in
compose
, interacting with each other 🙂
c
right
l
nw 🙂
c
sure
so you are basically saying you don’t really need
ViewPager
, just make the views in compose, and then treat them as tabs and bolt the nav logic on top
l
Well, I’m saying you could do that
c
yes
thanks it’s helpful I will look at the tab samples..
l
And, for navigation (really basic) there are already examples already
There’s a drawer example and JetSample handles it 🙂
State was not handled properly in the example
c
wow fantastic! thanks..
l
I have some code that integrates with RecyclerView and ViewPager. it’s a little bit hacky… but could put in a gist or something
👍 2
one thing to take into account is that while integration with android views is explicitly possible and was a primary design goal of compose, it is something where the IDE support for it right now is still really lacking
so we haven’t shown very many examples with it
because it feels wierd when the IDE complains about stuff or doesn’t work right and nothing is wrong
IDE support will happen, but at the moment we are putting more resources into getting the compose toolkit working smoothly
c
thanks Leland! that makes a lot of sense.. have you guys done any brainstorming on what the DSL could unlock, in terms of those kinds of UI patterns? (wizards, onboarding, multi-panel config, etc.)?
l
i have a few things in mind for sure. there was a cool hackathon project this week that hooked up compose to RemoteViews for notifications. Was nice that you could use compose to create dynamic UI in the notifications pane where the code felt seamlessly integrated with the rest of your UI
😮 4
and could be done from background services etc too
pretty cool
not sure if that is going to go anywhere, but might give you an idea for what type of things you could do
c
wow fantastic
l
there already exists some work in compose on a composer that builds of Vectors instead of ComponentNodes or Views. It could basically replace AnimatedVectorDrawable IMO
c
have a piece I need to do that is going to involve getting a moderately complex
ViewModel
to drive a bunch of composable `View`s so I think this should be a great way to go..