Marc (34) [Avatar] Offline
#1
Hi,
Almost every programming problem has multiple solutions.
Is it correct to think of Bait & Switch and IoC as two solutions to the "how do I access device-specific implementations from my common, .Core logic"?
Rather than prepare 3 separate libraries can I put
Mvx.RegisterType<Interface, Implementation>();
in the application-specific Setup.cs files?

It seems to me that creating 3 libraries (what, exactly, is a "library" in this context?) creates more "moving parts" than keeping all the source in 1 solution, and is thus less error prone.

Thx,
M.


Jim Bennett (88) [Avatar] Offline
#2
Depends on your use case - when building NuGets bait and switch was the best way to go as you just install the NuGet package and everything works, (though with the latest version of VS there is multi targeting - https://montemagno.com/new-plugin-for-xamarin-multi-target-templates-for-visual-studio-2017/).

IoC is for inside your app as you may use it for libraries from somewhere else, or code you've written yourself.