Reputation: 143
right now I am maintaining a Xamarin Multiplatform app that only had to satisfy the needs of one customer. My Visual Studio Solution consists of a Core project with ViewModels and resources as well as an iOS and an Android project with the UIs and platform specific code.
I now have to release the same app for a different customer with only slight changes.
So I was wondering, is there any possibility to have another iOS and android application that 'extends' my other projects, so that I can just override the parts that need changes?
I'm asking because I saw web applications that satisfy just exactly that issues by just including another project and than overriding different services for example.
Upvotes: 4
Views: 957
Reputation: 787
If these changes also include some logic, then I would also go with creating multiple Build configurations and using if directives. Then in your code you can have something like:
private void ExecuteApiCall()
{
#if COMPANY1
//do something
#elif COMPANY2
//do something else
#else
//do else
}
If it only requires some UI changes, you can also think about having multiple themes and then just assigning one to specific customer: https://medium.com/@milan.gohil/adding-themes-to-your-xamarin-forms-app-3da3032cc3a1
Upvotes: 1
Reputation: 5109
Yes there are a lot of ways to do that. Here are just two that came to the top of my head.
Method 1: Multiple Build configs (Intermediate level)
One way is to create multiple build configurations, and select what code is to be run depending on which build you are running. Basically to do this, and assuming you are using a Mac, and that all the data your UI uses comes from your ViewModels in your Core project. Then
Method 2: Azure Devops (Expert level)
If you want to do automate the entire process from commit to publish, Scott MacDougall, a developer, presented at a Toronto Xamarin Meetup shared exactly how you can resolve this problem using Azure Devops to manage over 10 apps that were to be released to different iOS & Android accounts. He would just makes the change once, and then once the ticket/issue/item/task was approved by QA, it would go right into each store. It is a lot more complicated and I would have to study it more to explain it to you.
Upvotes: 1