Hot Swap View Models: No Time for Monkey Business

Bogusław Błoński
2 min readNov 20, 2019

--

Hands on: Collection View + View Model Swap +demo data generator

Assumption you understand previous steps:

Context:

When working on “Front-end” you often need to wait for back-end to be build but in parallel UI need to consume non existing data and UI discussions have to be done with customer.

Main reason to have demo data generator is:

  • no back-end
  • need to present UI to customer

Where Customer is Product owner, Graphic designer…

Way to solution:

I’m fan of Adobe Flash, in 2010 Adobe Creative Cloud” than CS5 had Demo Data Generator which gave me possibility to display list of chairs an some description, that was amazing. By day time I was ASP.Net + WinForms developer and I didn’t know how to achieve that in Visual Studio, it wasn’t possible than.

Answer came soon with Microsoft Expression Blend and Laurent Bugnion lecture about MVVM and “blendability”. It was eye opener.

Before Hot Reload in my eyes it wasn’t as easy or even possible in XAMARIN.

Design Time Demo Data Generator

Main issues:

  • Demo data means in running app
  • Design time means in previewer

Which hot view model swap you can have both.

bogus for Boguś(sh)

In real life you won’t use monkeys as data, you need more complex business rules as birth, order date, names… , short and long description aligned to database entities or JSON properties. Need of Design Time Demo Data Generator.

Source code is best documentation:

Result of using View Model Swap + demo data generator

Replace of static to generated data

See:

Serie Starter:

--

--

Bogusław Błoński
Bogusław Błoński

Written by Bogusław Błoński

Did small internal corporate and big projects with over 1 000 000 active users in ASP.NET and XAMARIN.FORMS and XAMARIN.NATIVE. Blogging for better sleep.

No responses yet