intuit / CardParts

A reactive, card-based UI framework built on UIKit for iOS developers.
Other
2.52k stars 224 forks source link

A way to create cards and cardparts dynamically #26

Closed willysharp5 closed 6 years ago

willysharp5 commented 6 years ago

I want to create a number of these cards dynamically. I also want to create multiple instances of CardPartTextField dynamically and add to the setupCardParts array

croossin commented 6 years ago

Do you mean dynamically by some sort of response from the server that dynamically lays out multiple cards? I am unsure what you mean by dynamically in this case. If you want to create several CardPartTextField, you are able to append them to an array and then pass in that array to setupCardParts.

willysharp5 commented 6 years ago

Yes I meant dynamically from the server.

Also if I was to create multiple CardPartTextFields from the server would I have to create CardPartTextFields1, CardPartTextFields2 and so forth.

My question how do I dynamically create this without having to create 1,2... and so forth.

Thanks

croossin commented 6 years ago

While this is possible, it is not something that we support. You would request something from your server and based on the response, the client would dynamically render the Cards as well as the CardParts. We are taking a look at creating a rendering engine but have no planned ETA. Sorry!

briannadoubt commented 6 years ago

I have started implementing a system like the one described by @croossin. I'm using Firebase/Firestore with a collection of documents called layouts. Inside the layouts collection there are corresponding versioned documents, i.e. v1, v2, etc. to scale the data structure as needed. Inside each document are multiple array objects, each pertaining to a different CardPartsViewController containing arbitrary objects with values defining what type of card, in which order, and the content that the client should fetch/display. The client fetches this layout document and parses it into local layout objects that then generate a card and load the content. This gives me the flexibility to change the content of specific ViewControllers dynamically without needing to push new code to the App Store!

This is rather complicated, but maybe in the future I'll write a blog about it. If/when I do I'll post a link here!

croossin commented 6 years ago

That would be great, @bornbrie ! Please keep us informed of your progress and let us know if you have any issues with CardParts.