Setting up a shared project
To understand each option completely and what situations call for, let's define a solution structure for both shared projects and portable class libraries. Let's use the product search example from earlier in the chapter and set up a solution for each approach.
To set up a shared project, perform the following steps:
- Open Xamarin Studio and start a new solution.
- Select a new Single View App under the Multiplatform | App section.
- Name the app
ProductSearch
, and select Use Shared Library. - Complete this new project wizard and Xamarin Studio will generate three projects:
ProductSearch
,ProductSearch.Droid
, andProductSearch.iOS
. - Add the
Product
,ProductRepository
, andProductViewModel
classes to theProductSearch
project from earlier in this chapter. You will need to addusing System.Threading.Tasks;
andusing System.Linq;
where needed. - Click on Build | Build All from the menu at the top to double-check everything, and you have successfully set up a cross-platform...