Skip to content

Commit

Permalink
Fixed some compiler warnings.
Browse files Browse the repository at this point in the history
This commit adds a new using statement for System.Diagnostics and inserts a Debug.Assert statement to ensure that the View is not null. Additionally, the event handlers DidTapEvent and AnimationDidStopEvent have been updated to accept nullable sender arguments.
  • Loading branch information
mrbiggred committed Oct 1, 2023
1 parent 85b1a68 commit c2b5544
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
9 changes: 5 additions & 4 deletions Source/ExampleClient/MainViewController.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Diagnostics;
using SaturdayMP.XPlugins.iOS;

namespace ExampleClient;
Expand Down Expand Up @@ -37,24 +38,24 @@ public override void ViewDidLoad()
// https://github.com/Boris-Em/BEMCheckBox
checkbox.DidTap += DidTapEvent;
checkbox.AnimationDidStopFor += AnimationDidStopEvent;



// Add the controls to the view.
Debug.Assert(View != null);
View.AddSubview(bemCheckBoxLabel);
View.AddSubview(checkbox);
}

// Fired before the checkbox animation completes but after the internal
// checkbox settings are updated with the new check/unchecked status (i.e.
// On property is updated).
private void DidTapEvent(object sender, EventArgs eventArgs)
private void DidTapEvent(object? sender, EventArgs eventArgs)
{
Console.WriteLine("In BeforeCheckBoxClickedEvent which is DidTapCheckBox in BEMCheckBox.");
}

// Fired after the checkbox animation completes. If there are no animations then
// it won't be triggered.
private void AnimationDidStopEvent(object sender, EventArgs eventArgs)
private void AnimationDidStopEvent(object? sender, EventArgs eventArgs)
{
Console.WriteLine("In AfterCheckBoxClickedEvent which is AnimationDidStopForCheckBox in BEMCheckBox.");
}
Expand Down
16 changes: 5 additions & 11 deletions Source/SaturdayMP.XPlugins.iOS.BEMCheckBox/ApiDefinitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,31 +107,25 @@ interface BEMCheckBox : ICAAnimationDelegate
[Export("initWithFrame:")]
[DesignatedInitializer]
BEMCheckBox Constructor(CGRect frame);

// REM
//// -(instancetype _Nullable)initWithCoder:(NSCoder * _Nonnull)coder __attribute__((objc_designated_initializer));
//[Export ("initWithCoder:")]
//[DesignatedInitializer]
// BEMCheckBox Constructor (NSCoder coder);


// @property (nonatomic) CGRect frame;
[Export("frame", ArgumentSemantic.Assign)]
[Export("frame", ArgumentSemantic.Assign), Override]
CGRect Frame { get; set; }

// -(void)layoutSubviews;
[Export("layoutSubviews")]
[Export("layoutSubviews"), Override]
void LayoutSubviews();

// @property (readonly, nonatomic) CGSize intrinsicContentSize;
[Export("intrinsicContentSize")]
[Export("intrinsicContentSize"), Override]
CGSize IntrinsicContentSize { get; }

// -(void)setOn:(BOOL)on animated:(BOOL)animated;
[Export("setOn:animated:")]
void SetOn(bool on, bool animated);

// -(BOOL)pointInside:(CGPoint)point withEvent:(UIEvent * _Nullable)event __attribute__((warn_unused_result("")));
[Export("pointInside:withEvent:")]
[Export("pointInside:withEvent:"), Override]
bool PointInside(CGPoint point, [NullAllowed] UIEvent @event);

// -(void)animationDidStop:(CAAnimation * _Nonnull)anim finished:(BOOL)flag;
Expand Down

0 comments on commit c2b5544

Please sign in to comment.