[70068 Closed] Nougat: UILayoutPriority enum missing?

It seems that the UILayoutPriority enum is missing. It’s defined as

enum {
UILayoutPriorityRequired = 1000,
UILayoutPriorityDefaultHigh = 750,
UILayoutPriorityDefaultLow = 250,
UILayoutPriorityFittingSizeLevel = 50,
};
typedef float UILayoutPriority;

in NSLayoutConstraint.h. There are no CC options given for UILayoutPriority.UI… and using (for example) UILayoutPriority.UILayoutPriorityRequired gives an error (error E43: No static member “UILayoutPriorityRequired” on type “UILayoutPriority”).

Hmm, a float enum? we probably don’t handle this properly.

Thanks, logged as bugs://70068: Nougat: UILayoutPriority enum missing?

I worked around by adding:

private enum UILayoutPriorityConstants : Integer {
	UILayoutPriorityRequired = 1000,
	UILayoutPriorityDefaultHigh = 750,
	UILayoutPriorityDefaultLow = 250,
	UILayoutPriorityFittingSizeLevel = 50,
};

at the top of the class and it seemed to work OK to pass into methods that needed them. It looks like the C enum is a standard integer enum but the typedef is a float.

bugs://70068 got closed as fixed for release Bradbury Class

This is only sort of fixed on 1645. The enum constants are defined individually but not as part of an enum. For example this works

fTitleLabel.setContentHuggingPriority(UILayoutPriorityRequired) forAxis(UILayoutConstraintAxis.UILayoutConstraintAxisVertical);

but this doesn’t

fTitleLabel.setContentHuggingPriority(UILayoutPriority.UILayoutPriorityRequired) forAxis(UILayoutConstraintAxis.UILayoutConstraintAxisVertical);