Prototyping your app
Use sample data for live wireframes
Before connecting a backend, you can use Faker to generate mock users, addresses, business information, and more.
Here we generate an infinite number of sample customer values with Faker:
public static IEnumerable<Customer> SampleCustomers()
{
while (true)
{
yield return new Customer
{
FirstName = Faker.Name.First(),
LastName = Faker.Name.Last(),
Email = Faker.Internet.Email(),
Company = Faker.Company.Name(),
Street = Faker.Address.StreetAddress(),
City = Faker.Address.City(),
State = Faker.Address.StateAbbreviation(),
PostalCode = Faker.Address.ZipCode(),
ImageUrl = Faker.Avatar.Image(),
SmallPhotoUrl = Faker.Avatar.Image(null, "150x150"),
};
}
}
Use FieldBook for prototyping your backend
FiledBook makes adding a backend to your app as easy as creating a spreadsheet, and it has a .NET client (filedbook-sharp
on NuGet) that makes adding a simple backend to your Xamarin app just as easy:
Step 1: Create a Book and a Sheet
Visit fieldbook.com to create a free account and make your first book.
Make a ToDos
sheet that looks like this:
Step 2: Create a class to represent ToDos
class ToDo : FieldBook.IRow
{
// Required for IRow
public int Id { get; set; }
public string Name { get; set; }
public string Notes { get; set; }
public int Priority { get; set; }
public bool Finished { get; set; }
}
Step 3: Create your book and sheet objects
Click Manage API access
inside of FieldBook to get your book ID and create an API key.
Then make a Book
, and use the book to get a strongly typed reference to the sheet:
var book = new Book("book id", "api key name", "api key");
var sheet = book.GetSheet<ToDo>();
Step 4: Use the sheet to query, create, update, and delete ToDos
// List all todos
List<ToDo> allTodos = await sheet.List();
// Or just list some
var someTodos = await sheet.List(offset: 5, limit: 25);
// Get todo by Id
ToDo todo = await sheet.Get(0);
// Change a todo
todo.Priority = 10;
await sheet.Update(todo);
// Or update just some fields for more efficiency
await sheet.Update(todo, new { Priority = todo.Priority });
// Delete a todo
await sheet.Delete(todo);
// Create a todo
await sheet.Create(new ToDo
{
Priority = 1,
Name = "Build an app",
Description = "Awesomely with Xamarin",
});