Bug 60935 - NSGestureRecognizer.State is not declared get/set like iOS and makes custom recognizer broken
Summary: NSGestureRecognizer.State is not declared get/set like iOS and makes custom r...
Status: RESOLVED FIXED
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: Master
Hardware: PC Mac OS
: High normal
Target Milestone: 15.6
Assignee: Chris Hamons
URL:
Depends on:
Blocks:
 
Reported: 2017-11-30 22:53 UTC by Chris Hamons
Modified: 2017-12-11 17:29 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Chris Hamons 2017-11-30 22:53:16 UTC
So in obj-c they declare it read only

`@property (readonly) NSGestureRecognizerState state;`

and later use this to all subclases to set
    
    @interface NSGestureRecognizer (NSSubclassUse)
    
    // readonly for users of a gesture recognizer. may only be changed by direct subclasses of NSGestureRecognizer
    @property NSGestureRecognizerState state;  // the current state of the gesture recognizer. can only be set by subclasses of NSGestureRecognizer, but can be read by consumers
    
    
In iOS we handle this correctly:

		[Export ("state")]
		UIGestureRecognizerState State { get; set; }

but do not in XM:

		[Export ("state")]
		NSGestureRecognizerState State { get; }
Comment 1 Chris Hamons 2017-11-30 23:05:18 UTC
Possible workaround: https://gist.github.com/chamons/9593ff269f382461fe5359b1266573cf
Comment 2 Chris Hamons 2017-11-30 23:06:37 UTC
https://github.com/xamarin/xamarin-macios/pull/3074