Skip to content

Commit

Permalink
Add NullAllowed attributes. Fixes #9
Browse files Browse the repository at this point in the history
  • Loading branch information
wcoder committed Jan 5, 2024
1 parent 52bee79 commit cac8f1c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
15 changes: 12 additions & 3 deletions samples/ViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,18 @@ private void MakeBasic()

private void MakeWithDurationAndPosition()
{
View!.MakeToast(new NSString("This is a piece of toast on top for 3 seconds"),
3.0f,
CSToastPosition.Center);

View!.MakeToast(
message: new NSString("This is a piece of toast on top for 3 seconds"),
duration: 3.0f,
position: CSToastPosition.Center,
title: new NSString("Test Title"),
image: null,
style: null,
completion: (didTap) =>
{
Debug.WriteLine(didTap ? "Did Tap" : "No Tap");
});
}

private void MakeWithTitle()
Expand Down
15 changes: 13 additions & 2 deletions src/ApiDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,24 @@ interface Toast
void MakeToast(NSString message, nfloat duration, NSString position);

[Export("makeToast:duration:position:title:image:style:completion:")]
void MakeToast(NSString message, nfloat duration, NSString position, NSString title, UIImage image, CSToastStyle style, CompletionDelegate completion);
void MakeToast(
NSString message,
nfloat duration,
NSString position,
[NullAllowed] NSString title,
[NullAllowed] UIImage image,
[NullAllowed] CSToastStyle style,
[NullAllowed] CompletionDelegate completion);

[Export("showToast:")]
void ShowToast(UIView view);

[Export("showToast:duration:position:completion:")]
void ShowToast(UIView view, double duration, NSString position, CompletionDelegate completion);
void ShowToast(
UIView view,
double duration,
NSString position,
[NullAllowed] CompletionDelegate completion);

[Export("hideToast:")]
void HideToast(UIView view);
Expand Down

0 comments on commit cac8f1c

Please # to comment.