You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the legacy_nsgeometry_functions rule, SwiftLint replaces NSIntersectionRect(rect1, rect2) with rect1.intersect(rect2). CGRect does not have an intersect(_:) method, the correct method name would be intersection(_:), however, if two rectangles don’t intersect, the intersection(_:) method produces CGRect.null, while NSIntersectionRect(_:_:) produces CGRect.zero, so replacing it might silently break the code.
Environment
SwiftLint version? 0.43.1
Installation method used? Homebrew
Which Xcode version are you using? Xcode 12.5.1 (12E507)
Do you have a sample that shows the issue? echo "NSIntersectionRect(rect1, rect2)" | swiftlint lint --no-cache --use-stdin --enable-all-rules
The text was updated successfully, but these errors were encountered:
New Issue Checklist
Describe the bug
When using the
legacy_nsgeometry_functions
rule, SwiftLint replacesNSIntersectionRect(rect1, rect2)
withrect1.intersect(rect2)
. CGRect does not have anintersect(_:)
method, the correct method name would beintersection(_:)
, however, if two rectangles don’t intersect, theintersection(_:)
method producesCGRect.null
, whileNSIntersectionRect(_:_:)
producesCGRect.zero
, so replacing it might silently break the code.Environment
echo "NSIntersectionRect(rect1, rect2)" | swiftlint lint --no-cache --use-stdin --enable-all-rules
The text was updated successfully, but these errors were encountered: