Xamarin Shared Library and PCL -
what exact difference between xamarin shared project , portable class library?
when use shared library , when use portable class library?
is possible write native functionality in shared projects showing alert,accessing camera , use both android , ios?
can please explain me.
- in shared projects each code file compiled each destination (android, ios, windows phone etc). able include platform specific code using
#if
compiler directives. when want access camera need write access code inside#if
block destinated platforms. can mess code can easier find different implementations. learn more: http://developer.xamarin.com/guides/cross-platform/application_fundamentals/shared_projects/ - protable class libraries (pcl) compiled against general .net subset compatible platforms want. can access
system.net.http
cannot access platform specific code. if want access camera inside pcl code need access generalized interface via dependency injection. there pretty frameworks helping archieve goal. 1 of famous mvvmcross (https://github.com/mvvmcross/mvvmcross/wiki). learn more pcl: http://developer.xamarin.com/guides/cross-platform/application_fundamentals/building_cross_platform_applications/sharing_code_options/#portable_class_libraries
i perefer pcls because code easier read without compiler directives. using mvvmcross able use plenty of plugins via nuget. don't need write own classes camera access, showing alerts etc.
Comments
Post a Comment