Skip to content

Instantly share code, notes, and snippets.

@marek-safar
Last active July 2, 2021 15:13
Show Gist options
  • Save marek-safar/896a2aac983e2168dcbd5e1cff216100 to your computer and use it in GitHub Desktop.
Save marek-safar/896a2aac983e2168dcbd5e1cff216100 to your computer and use it in GitHub Desktop.
// inside partial class specific to implementation
const string Assembly = "Xamarin.iOS";
const string NativeHandlerType = "Name of the handler type in ios";
// This will be in shared mobile class
public bool UseCookies {
get
{
if (IsSocketHandler)
{
return _socketHandler!.UseCookies;
}
else
{
return GetUseCookies();
}
[DynamicDependency("get_UseCookies", NativeHandlerType, Assembly)]
bool GetUseCookies() => (bool)InvokeNativeHandlerMethod("get_UseCookies");
}
set
{
if (IsSocketHandler)
{
_socketHandler!.UseCookies = value;
}
else
{
SetUseCookies(value);
}
[DynamicDependency ("set_UseCookies", NativeHandlerType, Assembly)]
SetUseCookies(bool value) => InvokeNativeHandlerMethod("set_UseCookies", value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment