Xamarin Forms + Parse: PCL vs Shared Asset Project - parse-platform

I been set the mission to look at Xamarin and its cross plaform / code resuse ability, I come from a iOS/Android background.
I want to aim for the holy grail of one universal front end (basic) and one reusable service layer.
I created my first project as a Xamarin Forms PLC, hit the issue it can not support compiler directives, which seem to be something your going to need. Also I was unable to add Parse package to the PLC. You need to reference it per platform / write code per platform?
I have now created Shared Asset Project, the default setup (new project). This does not allow me to add parse to the shared layer. Some of the examples I see add a new project called service, what type of project is this?
So, my question is, forgetting how many members are in a dev team, which one (PCL, SAP) lets me have a universal backend (parse).

I found a Github sample project that could help you. It can be found here: Sample Parse Project
The link to the xamarin component can be found here: Parse component This Xamarin Component should be able to be added into your project and it should get you started immediately. Also when you add the component to you project you should be able to view sample projects that come along with it.
I would start with the sample project and see what I can do with it, but it should become a lot easier by just adding the Parse component in. This would make it so you could probably use either type of project with some Dependency Injection.

Related

Xamarin Forms Customer Control Library

I need to create a reusable Xamarin Forms control that will be used in two separate projects. It does require custom renderers for IOS and Android. The problem is I cannot figure our what kind of project to use to create a reusable custom control library for Xamarin forms.
Every site seems to talk about creating customer controls that can be reusing in the same project. But I need it in a separate project for reuse.
Can someone please point me in the right direction.
Depending what are your needs regarding multi-targeting, using a solution with a shared project of type MSBuild.Sdk.Extras could be very helpful. You can then packed your shared project into a package that you can reference from your apps project and use locally.
Examples that might guide you and shows you the path are known nuget packages that are being used by app developers cross-platforms, just an example Xamarin.Forms.PancakeView.
Related to MSBuild.Sdk.Extras: How to use different base class in custom control depending on platform target?

Cross Platform Blank App Xamarin Project

I'm trying to create an app using Visual Studio and Xamarin that will be cross platform. I've been trying to follow a tutorial I found online to do this.
When the guy in the video went to create a new project, he had the below screen, and created a Blank App (Xamarin.Forms Portable
I've installed the necessary components (Xamarin, WPF and a couple of others) with the IDE, however I don't see this option.
I've created a project using Mobile App (Xamarin.Forms) but it doesn't have the same structure as the desired template. Am I missing a component? Is the template called something different now?
The video is almost two years old, which means that some parts look different today.
If you click on the create a new xamarin.forms app, you will come to a new step where you can choose a blank app.
Then you have a choice, either choose shared projects or .net (portable).
The .net will give you a portable class library, like that in the video.
The two methods have different advantages.
Read more in the documentation: https://learn.microsoft.com/sv-se/xamarin/cross-platform/app-fundamentals/code-sharing
I hope the information will help you!

Cannot add Judopay to Xamarin forms project

I am trying to include Judopay in my project, and I was able to add it to Android and iOS, but not to the Xamarin forms project. There is no NuGet to be included and I can't seem to add the component reference. Any idea on how can I add it? I cannot use any of these:
using JudoDotNetXamarin;
using JudoPayDotNet.Enums;
using JudoPayDotNet.Models;
Again, they only work on iOS or Android, but not Xam forms.
That is because they only provide platform implementations. You will need to tell your Forms app which implementation to use at what time.
The correct way to go about this is with some form of IoC, using dependency injection or service location. Luckily Xamarin Forms has this integrated:
https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/dependency-service/introduction/
Using the references from the Android or iOS projects in your shared code will likely not work completely or break things. Maybe not immediately but surely later on. (Except when there really is no platform-specific functionality, then you might get away with this.)

Integrating xamarin, CouchBaseLite, MVVMCross and SyncGateway such that View changes with database

I am working on a xamarin project where i use CouchBase Lite as my Local database. I also want to use MVVMCross library. Could anyone specify where should i include couchbase-Lite library, MVVMCross - hot tuna library(like class library or portable class library or platform specif project) such that view model gets notified about the changes in Couchdatabase.
Basically i want to change the view whenver there is a change in database i want to change the view with mvvmcross. Am using syncgateway to sync with server Couchbase bucket.
I am new to Xamarin, MVVM and CouchBaselite.
I couldnt find any concrete example for all this.
Thanks in advance.
I would perhaps just use the CouchBaseLite Xamarin Component. If you are wanting to access this in your PCL Core project you will probably have to create some sort of wrapper around the component and inject it properly into each platform. You can use the MvvmCross plugins wiki to get you started.
I know this is an old thread, but there's a new MvvmCross plugin for Couchbase, and basically does everything you want. It's in alpha, as of this writing on Nuget, and open source on Github. I was actually looking for the same, and happy to have found it! :)
https://www.nuget.org/packages/MvvX.Plugins.CouchBaseLite.ForestDB
https://github.com/mathieumack/MvvX.CouchBaseLite

Is it possible to perform Sqlite sync via Azure Mobile Services completely within Xamarin Forms iOS PCL project

After spending two straight days chasing the answer, I have to fall back and just ask:
Is it possible to perform Sqlite sync via Azure Mobile Services completely within Xamarin Forms iOS PCL project?
Any examples I have looked at (including those that claim that their emphasis is on PCL) all end up instantiating the MobileServicesClient within the Native iOS part of the solution, as well as performing the Sqlite sync via Azure Mobile Services within the native project as well.
My goal is to have a Xamarin.Forms solution, which relies on a Sqlite / Azure Mobile Services sync for all of its data and its offline needs. Such solution would not have to have any additional platform specific code, beside what is generated by the project template.
Furthermore, I intent on using Syncfusion Xamarin charts library, which only works within Xamarin.Forms project. The idea is to have Syncfusion chart source its data from the local Sqlite db, which, in turn, is periodically auto-refreshed using Azure Mobile Services Sqlite sync.
I think, that if I had to do all if the data sync business within my platform specific project, then I may not be able to use this Syncfusion Forms-only library.
Is it actually possible to do the Sqlite / Azure sync completely within the bounds of the PCL?
-Eugene
Yes, you can do so. Check out the book - http://aka.ms/zumobook - particularly Chapter 3. In addition, check out the underlying repo (link in the book) - there are several example setups of Xamarin Forms with Offline Sync in SQLite in there. The Chapter3 sample is a good place to start.
I'm able to use them with my project with removing Silverlight optins from my PCL project because of some System.Web methods are not available with it.
On PCL:
Microsoft.IdentityModel.Clients.ActiveDirectory
Newtonsoft.Json
SQLite.Net
SQLite.Net.Async
On iOS Project:
Microsoft.IdentityModel.Clients.ActiveDirectory, Version=3.1.0.0
Microsoft.IdentityModel.Clients.ActiveDirectory.Platform
Newtonsoft.Json
SQLite.Net
SQLite.Net.Platform.XamarinIOS.Unified

Resources