Tuğçe Arar

Fields of Blue by Exphrasis

CoreML allows us to develop a Machine Learning project on iOS. Applications developed using CoreML can perform all kinds of tasks such as problem solving, image recognition using trained models.

We can do this with Xamarin.iOS. The first thing you have to do for this is to set ourselves a model. We download a model from the link below:

https://developer.apple.com/machine-learning/

We then have to convert it to mlmodelc type to add Xamarin project. We can use Xcode or terminal for this. We should right click on folder that include our CoreML model and then select New Terminal at Folder. After that write tihs command in terminal;

xcrun coremlcompiler compile MyModel.mlmodel MyModel.mlmodelc

this gives us the output of .mlmodelc which we can use in our project. Once we add this model to our project, we can start to develop.

--

--

Underground Cavern by laspinter

We can use MessagingCenter for this. In your first page, subscribe a message:

public FirstPage()
{
MessagingCenter.Subscribe<SecondPage>(this, "StartProgress", (sender) =>
{
StartProgress();
});
}

public void StartProgress()
{
//do progression here
//and set Progress bar
}

In second page send the message:

private void Onpress(s, e)
{
MessagingCenter.Send(this, "StartProgress");
Navigation.PopToRootAsync();
}

You can find documentation in here.

--

--

by TsaoShin

We can create a simple round buttton with font icon in Xamarin.Forms application like below:

  1. Add font family to your shared app as an EmbeddedResource
  2. Register the font file with the assembly, in a file such as AssemblyInfo.cs, using the ExportFont attribute.
using Xamarin.Forms;using Xamarin.Forms.Xaml;[assembly: XamlCompilation(XamlCompilationOptions.Compile)][assembly: ExportFont(“fa-solid-900.ttf”, Alias = “fa-solid”)]

3. Create a resource in App.xaml

<Application.Resources><x:String x:Key="IconCheck">&#xf00c;</x:String></Application.Resources>

4.Create a button in Page.xaml

--

--

by Rajanandepu

We can use DependencyService to check if notifications is enabled for the app.

In iOS:

[assembly: Dependency(typeof(DeviceService))]
class DeviceService : IDeviceService
{
public bool GetApplicationNotificationSettings()
{
var settings = UIApplication.SharedApplication.CurrentUserNotificationSettings.Types;
return settings != UIUserNotificationType.None;
}
}

In Forms:

public interface IDeviceService
{
bool GetApplicationNotificationSettings();
}

And after these, you can call your DependencyService from your page or view model like this:

bool isNotificationEnabled = DependencyService.Get<IDeviceService>().GetApplicationNotificationSettings();

--

--

by F-Kroll

You can open your pages dynamically in your Xamarin.Forms application. For that we can use Type.GetType(string):

async Task OpenPage(object obj)
{
var pageType= Type.GetType($"NamespaceOfYourView.{obj}");
var page = Activator.CreateInstance(pageType) as Page;
await Application.Current.MainPage.Navigation.PushAsync(page );
}

You can read details of Type.GetType in here.

--

--

by sanitrance

SecKeyRef using KeyChain access to read and write key as stated in official documentation:

A SecKeyRef instance that represents a key that is stored in a keychain can be safely cast to a SecKeychainItemRef for manipulation as a keychain item. On the other hand, if the key is not stored in a keychain, casting the object to a SecKeychainItemRef and passing it to Keychain Services functions returns errors.

Having a provisioning profile in iOS application developed in Xcode to use SecKeyRef is not required, but in Xamarin.iOS application in Visual Studio for Mac, it is required to use Entitlements.plist to enable keychain access. So if your binding library used the SecKey API, you need to enable KeyChain Access in Entitlements.plist and set apple developer account in your project.

<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)com.company.yourapp</string>
</array>

--

--