Skip to content

Commit

Permalink
Merge pull request #10 from Softeq/feature/allow-null-args
Browse files Browse the repository at this point in the history
Extend public API
  • Loading branch information
wcoder authored Jan 9, 2024
2 parents 52bee79 + a1b2ab6 commit 5b9cdd7
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
2 changes: 1 addition & 1 deletion azure-pipelines/templates/vars.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
variables:
MACOS_VM_IMAGE: 'macos-12'
MACOS_VM_IMAGE: 'macos-13'
18 changes: 15 additions & 3 deletions samples/ViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,21 @@ 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);
var position = CSToastPosition.Center;
// or custom coordinates:
// var position = NSValue.FromCGPoint(new CGPoint(30, 200));

View!.MakeToast(
message: new NSString("This is a piece of toast on top for 3 seconds"),
duration: 3.0f,
position: position,
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,
NSObject 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
8 changes: 4 additions & 4 deletions src/ToastBindings.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
<Title>Toast for Xamarin.iOS</Title>
<Description>Xamarin iOS binding library of Toast - toast notifications to the UIView.</Description>
<Company>Softeq Development Corporation</Company>
<Copyright>Copyright © 2018 Softeq Development Corporation</Copyright>
<Version>4.0.0.2</Version>
<Copyright>Copyright © 2024 Softeq Development Corporation</Copyright>
<Version>4.0.0.3</Version>
<Authors>Softeq Development Corp.</Authors>
<Owners>Softeq Development Corp.</Owners>
<PackageProjectUrl>https://github.com/Softeq/Toast-xamarin-ios</PackageProjectUrl>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageTags>toast;ios;xamarin;binding;softeq;library;uikit;ui</PackageTags>
<PackageTags>toast;ios;xamarin;binding;softeq;library;uikit;ui;maui;dotnet;mobile</PackageTags>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReleaseNotes>Migration to .NET6</PackageReleaseNotes>
<PackageReleaseNotes></PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 5b9cdd7

Please # to comment.