SnapKit / SnapKit

A Swift Autolayout DSL for iOS & OS X

Home Page:https://snapkit.github.io/SnapKit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why is it not allowed to update required priority?

i-tengfei opened this issue Β· comments

New Issue Checklist

🚫 If this template is not filled out your issue will be closed with no comment. 🚫

  • I have looked at the Documentation
  • I have read the F.A.Q.
  • I have filled out this issue template.

Issue Info

Info Value
Platform e.g. ios
Platform Version e.g. 15.0
SnapKit Version e.g. 5.6

Issue Description

I try to update a required priority, but it fails, then I see code like this, why is it not allowed to update required priority?

if (layoutConstraint.priority.rawValue < requiredPriority), (self.priority.constraintPriorityTargetValue != requiredPriority) {

We are also seeing this issue.
Pre iOS 13, updating layout priority from required to a lower value would give a crash.
Read more here: https://stackoverflow.com/a/31186261
However, from iOS 13 and up it is now possible to update the priority and it would be great if SnapKit would allow this as well.