Giter VIP home page Giter VIP logo

xplugins.ios.bemcheckbox's Introduction

GitHub release (with filter) Nuget CI Release Notes GitHub Sponsors

XPlugins.iOS.BEMCheckBox

This plugin lets you use the BEMCheckBox in your .NET iOS applications. This README outlines how to get started with BEMCheckBox in .NET and some common uses. For a list of all the features of the please see the BEMCheckBox GitHub page.

Installing

XPlugins is a NuGet Package and can be installed using the dotnet command line:

dotnet add package SaturdayMP.XPlugins.iOS.BEMCheckBox

You can find other ways to install the latest stable version of the BEMCheckBox XPlugin via NuGet. You can find work in progress (WIP) and alpha builds on MyGet. If you have any trouble installing please let me know by opening an issue.

Quickstart

To create a BEMCheckBox call the constructor with a frame as shown below.

var checkbox = new SaturdayMP.XPlugins.iOS.BEMCheckBox(new CoreGraphics.CGRect(140, 40, 25, 25));

You can modify things such as making the checkbox square:

checkbox.BoxType = BEMBoxType.Square;

You can also change the animation type:

checkbox.OnAnimationType = BEMAnimationType.Fill;
checkbox.OffAnimationType = BEMAnimationType.Fill;

Yes you can set the on and off animation types to be different. You can set the color:

checkbox.OnFillColor = UIColor.Red;

To change if the checkbox is checked or not:

// Check to the checkbox.
checkbox.On = true;

// Uncheck the checkbox.
checkbox.On = false;

Finally to handle checkbox clicks setup an event:

private void CheckBoxClickedEvent(object sender, EventArgs eventArgs)
{
  var checkbox = sender as BEMCheckBox;
  if (checkbox == null)
    return;
    
  // Do what you need to do with the checkbox.
}

Then subscribe to it:

checkbox.AnimationDidStopFor += CheckBoxClickedEvent;

For a full list of settings such as animation type, colours, etc see the BEMCheckBox page.

You can also play with the BEMCheckBox settings in the Example Client. To run the Example Client open the source in Visual Studio 2017 and set the Example Client as the startup project. If the Example Client does not run please let me know.

Version Mapping

Below is the mapping of the BEMCheckBox version used in the XPlugin wrapper version along with the Xamain/.NET version.

The .NET version lists the minimum .NET and iOS versions required. For example, `net6.0-ios12`` means the XPlugin will work with .NET 6.0 and iOS 12 or higher (e.g. it will work with .NET 7 and iOS 16).

Please let me know if this XPlugin does not work work with a future version of .NET or iOS by opening an issue.

XPlugin BEMCheckBox Frameworks/Minimum Version
1.4.1 1.4.1 Xamarin.iOS/xamarinios10
1.4.2 1.4.1 Xamarin.iOS/xamarinios10
1.4.3 1.4.1 Xamarin.iOS/xamarinios10
2.0.0 2.0.0 Xamarin.iOS/xamarinios10
3.0.0 2.0.0 .NET/net6.0-ios16.1
3.0.1 2.0.0 .NET/net6.0-ios12.0

Acknowledgements

Thanks to Boris Emorine for creating the BEMCheckBox.

Further Reading

Microsoft Learning

Walkthrough: Bind an iOS Swift library

Noise from the Basement

Today I Learned How to Create a Xamarin iOS Binding for Objective-C Libraries:

Today I Learned How to Automate Objective-c Builds in TeamCity

The above is bit outdated as the BEMCheckBox is now a Swift project but the overall steps are the same.

xplugins.ios.bemcheckbox's People

Contributors

mrbiggred avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

omatrot

xplugins.ios.bemcheckbox's Issues

net6.0-ios migration

Hello,

The existing version won't work as is with net6.0-ios due to breaking changes. These are also documented here.

Right now you get the following error - error NU1202: Package SaturdayMP.XPlugins.iOS.BEMCheckBox 1.4.3 is not compatible with net6.0-ios15.2 (.NETCoreApp,Version=v6.0). Package SaturdayMP.XPlugins.iOS.BEMCheckBox 1.4.3 supports: xamarinios10 (Xamarin.iOS,Version=v1.0)

Do you have any plans to support net6.0-ios since the GA is scheduled for Q2 2022?

The samples from https://github.com/xamarin/xamarin-macios/tree/main/tests/dotnet might be helpful.

Thank you,
Cosmin

Incomplete Bitcode error in submission

Hi,
i have included this nuget package in my project, and i face issue for compiling in bitcode enable. Can i know how can i use this package in bitcode enable project? Thanks.

Below is the error message from submission to iTune Connect.

ERROR ITMS-90668: "Invalid Bundle Executable. The executable file 'InstantApp.BoostOrder.Customer.Touch.app/Frameworks/BEMCheckBox.framework/BEMCheckBox' contains incomplete bitcode. To compile binaries with complete bitcode, open Xcode and choose Archive in the Product menu."

Icon for the Project

Currently we don't have an icon for the project. I wonder if Liv can draw something for me?

DidTapCheckBox is not called

I'm using version 1.4.3.
Xamarin.iOS
Version: 13.18.1.31 (Visual Studio Community)
Hash: b3eedfed9
Branch: d16-6
Build date: 2020-04-09 10:22:36-0400

Neither DidTapCheckBox nor AnimationDidStopForCheckBox subscription are working.
The event method is not called.

BEMCheckBox checkbox = new BEMCheckBox { TranslatesAutoresizingMaskIntoConstraints = false };
// Wire the check event
checkbox.DidTapCheckBox += Checkbox_DidTapCheckBox;
...

private void Checkbox_DidTapCheckBox(object sender, EventArgs e)
{
    throw new NotImplementedException();
}

What could be wrong?

Selected event for CheckBoxGroup

I have set of four CheckBoxes inside CheckBoxGroup to mimic the behavior of RadioButtonGroup.
There are no bindable properties inside CheckBox class which I can use with MvvmCross (or maybe I just didn't find them?). Thus I wanted to subscribe on DidTapCheckBox or AnimationDidStopForCheckBox events and Execute a command from ViewModel on the events.

Events are invoked perfectly without CheckBoxGroup. But if I add them to CheckBoxGroup then no handlers are called at all, nor DidTapCheckBox nor AnimationDidStopForCheckBox. It seems like CheckBoxGroup consumes a user's tap, changes its own CheckBoxGroup.SelectedCheckBox and then suppress the tap propagation, so no DidTapCheckBox event is fired on any single CheckBox.

Actually, it's reasonable behavior for a group of controls but the problem is that CheckBoxGroup does not expose external event I can subscribe on to know when CheckBoxGroup.SelectedCheckBox was changed. Or maybe I should use another mechanism for it?

var dev  = new BEMCheckBox();
var test = new BEMCheckBox();
var demo = new BEMCheckBox();
var live = new BEMCheckBox();

dev .DidTapCheckBox += (_,__) => ViewModel.Dev .ExecuteAsync();
test.DidTapCheckBox += (_,__) => ViewModel.Test.ExecuteAsync();
demo.DidTapCheckBox += (_,__) => ViewModel.Demo.ExecuteAsync();
live.DidTapCheckBox += (_,__) => ViewModel.Live.ExecuteAsync();

var boxGroup = new BEMCheckBoxGroup()
{
    //SelectedCheckBox = dev,
    //MustHaveSelection = true
};
boxGroup.AddCheckBoxToGroup(dev);
boxGroup.AddCheckBoxToGroup(test);
boxGroup.AddCheckBoxToGroup(demo);
boxGroup.AddCheckBoxToGroup(live);

ExampleClient cannot find namespace SaturdayMP.XPlugins.iOS

When compiling the ExampleClient, I'm getting the following build error:

The type or namespace name 'SaturdayMP' could not be found (are you missing a using directive or an assembly reference?)

The SaturdayMP.XPlugins.iOS.BEMCheckBox project has generated the c# classes in the /obj/ios/SaturdayMPXPluginsiOS folder. But the generated public classes are not available in the ExampleClient project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.