I have a iOS/Android PCL project and want to implement Manatee scanner, but their samples don't cover PCL.
The sample provided for iOS:
scanButton.TouchUpInside += async (sender, e) => {
//Make an instance of scanner
var scanner = new MWBarcodeScanner.Scanner();
//Call the scaner and wait for result
var result = await scanner.Scan();
//If canceled, result is null
if (result != null){
new UIAlertView(result.type, result.code, null, "Close", null).Show();
}
};
I am trying to convert it for my PCL project, and have an interface declared in the PCL project. In my iOS project I have this, but can't think how to complete it:
using System.Threading.Tasks;
using ManateeScanner.iOS.Helpers;
using Xamarin.Forms;
using MWBarcodeScanner;
using UIKit;
[assembly: Dependency(typeof(ManateeScanningService))]
namespace ManateeScanner.iOS.Helpers
{
using iScan.PlatformDependency;
public class ManateeScanningService : IManateeScanningService
{
public async Task<string> ScanAsync()
{
//Make an instance of scanner
var scanner = new MWBarcodeScanner.Scanner();
//Call the scaner and wait for result
var result = scanner.Scan();
//If canceled, result is null
if (result != null)
{
return result;
}
}