0

Does Snapkit provide constants to replace the deprecated functions .priorityMedium() .priorityHigh() and .priorityLow() ?

The suggested replacement is to use .priority(amount), but I can't find anywhere that mentions how the numbering works - is a higher number a higher priority? ie, Can I use 0 for low, 500 for medium, and 1000 for high?

It would make sense if the deprecated methods now had constants to replace them, so I feel like I am just looking in the wrong place.

Thanks!

Nico teWinkel
  • 870
  • 11
  • 19

1 Answers1

0

In general the higher priority the more important the constraint is so your values for low/medium/high are valid.

However after inspecting SnapKit codebase you can find this fragment with default values for required/high/medium/low.

public static var required: ConstraintPriority {
    return 1000.0
}

public static var high: ConstraintPriority {
    return 750.0
}

public static var medium: ConstraintPriority {
    #if os(OSX)
        return 501.0
    #else
        return 500.0
    #endif

}

public static var low: ConstraintPriority {
    return 250.0
}

So you can use this like .priority(.high) instead of priorityHigh().

Mr. Hedgehog
  • 966
  • 4
  • 13