Giter Club home page Giter Club logo

wtfautolayout's People

Contributors

johnpatrickmorgan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wtfautolayout's Issues

Text not rendered correctly

First, thanks for this awesome tool!

There is a problem of formatting with the <code> tag. See:

screenshot 2018-11-01 at 07 47 37

I guess the translatesAutoresizingMaskIntoConstraints text should be in another font without the <code> tags?

Error: Expected: '.' in dot attribute

This layout error produces an error on the site:

(
    "<NSLayoutConstraint:0x600001707c50 UIStackView:0x7fed434775c0.width == UIScrollView:0x7fed24024000.width   (active)>",
    "<NSLayoutConstraint:0x6000017e8e60 'UISV-alignment' UILabel:0x7fed2355f060'Please keep this key in a...'.leading == _TtGC8MyAppXYZ8CardViewCS_P10$10582914415RecoveryKeyView_:0x7fed43476280.leading   (active)>",
    "<NSLayoutConstraint:0x6000017e8ff0 'UISV-alignment' UILabel:0x7fed2355f060'Please keep this key in a...'.trailing == _TtGC8MyAppXYZ8CardViewCS_P10$10582914415RecoveryKeyView_:0x7fed43476280.trailing   (active)>",
    "<NSLayoutConstraint:0x6000017e8dc0 'UISV-canvas-connection' UILayoutGuide:0x600000d7ea00'UIViewLayoutMarginsGuide'.trailing == UILabel:0x7fed2355f060'Please keep this key in a...'.trailing   (active)>",
    "<NSLayoutConstraint:0x6000017e8be0 'UISV-canvas-connection' UILayoutGuide:0x600000d7ea00'UIViewLayoutMarginsGuide'.leading == UILabel:0x7fed2355f060'Please keep this key in a...'.leading   (active)>",
    "<NSLayoutConstraint:0x6000017e9130 'UIView-Encapsulated-Layout-Width' UIScrollView:0x7fed24024000.width == 0   (active)>",
    "<NSLayoutConstraint:0x6000017e8a00 'UIView-leftMargin-guide-constraint' H:|-(22)-[UILayoutGuide:0x600000d7ea00'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':UIStackView:0x7fed434775c0 )>",
    "<NSLayoutConstraint:0x6000017e8aa0 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x600000d7ea00'UIViewLayoutMarginsGuide']-(22)-|(LTR)   (active, names: '|':UIStackView:0x7fed434775c0 )>"
)

Error:

Line 7, Column 179
    "<NSLayoutConstraint:0x6000017e8e60 'UISV-alignment' UILabel:0x7fed2355f060'Please keep this key in a...'.leading == _TtGC8MyAppXYZ8CardViewCS_P10$10582914415RecoveryKeyView_:0x7fed43476280.leading   (active)>",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Expected: '.' in dot attribute
Expected: valid partial identifier character

The output is exactly what came out of Xcode, except that I replaced my app’s name with MyAppXYZ (a string of the same length).

file name with + sign shows syntax error

When a file name has + sign it shows a syntax error:

 
Line 3, Column 68
    "<SnapKit.LayoutConstraint:0x7feb4e8fa260@PViewController+Ext.swift#21 App_Debug.StackView:0x7feb4e8d58b0.leading == UILayoutGuide:0x7feb50d2aa70.leading + 10.0>",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Expected: '#' in constraint instance.file location
Expected: file location in constraint instance

Removing the sign + fixes the error.

Make a Graphic Rendering

In addition to the list of constraints, draw rectangles properly depending on the given constraints to better visualize how the constraints interact.

Multiple permalinks for the same query

If you parse:

(
    "<NSLayoutConstraint:0x17468b860 progress background.height == 5   (active, names: progress background:0x1089a5290 )>"
)

and click "Permalink", it gives you this URL:

https://www.wtfautolayout.com/?constraintlog=%0A%0A%22%3CNSLayoutConstraint%3A0x17468b860%20progress%20background%2Eheight%20%3D%3D%205%20%20%20%28active%2C%20names%3A%20progress%20background%3A0x1089a5290%20%29%3E%22%0A%0A

and if you click "Permalink" again, it gives you this URL:

https://www.wtfautolayout.com/?constraintlog=%22%3CNSLayoutConstraint%3A0x17468b860%20progress%20background%2Eheight%20%3D%3D%205%20%20%20%28active%2C%20names%3A%20progress%20background%3A0x1089a5290%20%29%3E%22

It should either hide the button if the constraintlog parameter exists, either return the same value everytime for the same query.

Unexpected input issue with NSSpace

Hello!

When I run this input:

    "<NSAutoresizingMaskLayoutConstraint:0x283c8f570 h=-&- v=&-- UIView:0x10f754f20.height == 86   (active)>",
    "<NSLayoutConstraint:0x283c8c820 V:|-(0)-[UIButton:0x10f755100'Cancel']   (active, names: '|':UIView:0x10f754f20 )>",
    "<NSLayoutConstraint:0x283c8c870 UIButton:0x10f755100'Cancel'.height == 52   (active)>",
    "<NSLayoutConstraint:0x283c8c8c0 UILayoutGuide:0x2826f9880'UIViewLayoutMarginsGuide'.bottom == UIButton:0x10f755100'Cancel'.bottom NSSpace(0)   (active)>",
    "<NSLayoutConstraint:0x283c8c730 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x2826f9880'UIViewLayoutMarginsGuide']-(42)-|   (active, names: '|':UIView:0x10f754f20 )>"

I get this output:

UNEXPECTED INPUT:
Line 4, Column 136
    "<NSLayoutConstraint:0x283c8c8c0 UILayoutGuide:0x2826f9880'UIViewLayoutMarginsGuide'.bottom == UIButton:0x10f755100'Cancel'.bottom NSSpace(0)   (active)>",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
EXPECTED:
whitespace
whitespace or digit in number
'*' in *
'+' in +
'>' in >"
whitespace or '(' in info
'-' in -

Thank you!

Unexpected Input error for firstBaseline

The following results in an Unexpected Input error. Changing "firstBaseline" to "bottom" fixes the issue.

(
    "<SnapKit.LayoutConstraint:[email protected]#88 NSKVONotifying_LQRoundedCornerView:0x7ff92c7ec1f0.height >= 44.0>",
    "<SnapKit.LayoutConstraint:[email protected]#91 UIView:0x7ff92c7ec3c0.height == 1.0>",
    "<SnapKit.LayoutConstraint:[email protected]#97 UIView:0x7ff92c7ec560.height == UIView:0x7ff92c7ec3c0.height>",
    "<SnapKit.LayoutConstraint:[email protected]#100 UIView:0x7ff92c7ec560.centerY == NSKVONotifying_LQRoundedCornerView:0x7ff92c7ec1f0.bottom>",
    "<SnapKit.LayoutConstraint:[email protected]#43 UIView:0x7ff92e29e6f0.top == NSKVONotifying_LQRoundedCornerView:0x7ff92c7ec1f0.top>",
    "<SnapKit.LayoutConstraint:[email protected]#44 UIView:0x7ff92e29e6f0.bottom == UIView:0x7ff92c7ec560.bottom>",
    "<SnapKit.LayoutConstraint:[email protected]#142 UILabel:0x7ff92c74c9e0.top == UIView:0x7ff92e29e6f0.topMargin>",
    "<SnapKit.LayoutConstraint:[email protected]#143 UILabel:0x7ff92c74c9e0.firstBaseline == UIView:0x7ff92e29e6f0.bottomMargin>"
)
UNEXPECTED INPUT:
Line 9, Column 94
    "<SnapKit.LayoutConstraint:[email protected]#143 UILabel:0x7ff92c74c9e0.firstBaseline == UIView:0x7ff92e29e6f0.bottomMargin>"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
EXPECTED:
'm' in minX
't' in trailing
'l' in leading
'h' in height
'm' in minY
'm' in maxY
'm' in midY
'm' in midX
'r' in right
'm' in maxX
'b' in bottomMargin
attribute in dot attribute
't' in trailingMargin
'l' in leadingMargin
'b' in bottom
'c' in centerX
'l' in left
'b' in baseline
'w' in width
't' in top
't' in topMargin
'c' in centerY

Brilliant project! Thanks so much for creating this!

Unexpected Input for ']'

I have an error with a pasted log :

UNEXPECTED INPUT:
Line 5, Column 98
    "<NSLayoutConstraint:0x600003cb7200 V:|-(20)-[Common.LocalizableLabel:0x7fc0160d2170'Aujourd'hui']   (active, names: '|':MesComptes.ScheduleWidgetView:0x7fc0160d1f60 )>",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
EXPECTED:
']'

Source :

(
    "<NSLayoutConstraint:0x600003c69cc0 UILayoutGuide:0x6000025678e0'UIViewSafeAreaLayoutGuide'.bottom == UIImageView:0x7fc0160d1450.bottom + 20   (active)>",
    "<NSLayoutConstraint:0x600003c68cd0 UIImageView:0x7fc0160d1450.top == UILayoutGuide:0x6000025678e0'UIViewSafeAreaLayoutGuide'.top + 35   (active)>",
    "<NSLayoutConstraint:0x600003c63d90 MesComptes.HourGauge:0x7fc0160d03e0.height == 55   (active)>",
    "<NSLayoutConstraint:0x600003cb7200 V:|-(20)-[Common.LocalizableLabel:0x7fc0160d2170'Aujourd'hui']   (active, names: '|':MesComptes.ScheduleWidgetView:0x7fc0160d1f60 )>",
    "<NSLayoutConstraint:0x600003cb5f40 V:[Common.LocalizableLabel:0x7fc0160d2170'Aujourd'hui']-(20)-[MesComptes.HourGauge:0x7fc0160d03e0]   (active)>",
    "<NSLayoutConstraint:0x600003cb56d0 V:[Common.SelfSizedTableView:0x7fc0169a5800]-(20)-|   (active, names: '|':MesComptes.ScheduleWidgetView:0x7fc0160d1f60 )>",
    "<NSLayoutConstraint:0x600003cb5680 V:[MesComptes.HourGauge:0x7fc0160d03e0]-(30)-[Common.SelfSizedTableView:0x7fc0169a5800]   (active)>",
    "<NSLayoutConstraint:0x600003cb5e00 V:|-(0)-[MesComptes.PhoneWidgetView:0x7fc0160d0d70]   (active, names: '|':MesComptes.MCAgenciesSearchDetailHoursWidgetsView:0x7fc0160f2380 )>",
    "<NSLayoutConstraint:0x600003cb4500 MesComptes.PhoneWidgetView:0x7fc0160d0d70.bottom == MesComptes.ScheduleWidgetView:0x7fc0160d1f60.top   (active)>",
    "<NSLayoutConstraint:0x600003cb6b20 MesComptes.ScheduleWidgetView:0x7fc0160d1f60.bottom == MesComptes.DaysWidgetView:0x7fc0160f5fe0.top   (active)>",
    "<NSLayoutConstraint:0x600003cb5360 MesComptes.DaysWidgetView:0x7fc0160f5fe0.bottom == MesComptes.MCAgenciesSearchDetailHoursWidgetsView:0x7fc0160f2380.bottom   (active)>",
    "<NSLayoutConstraint:0x600003cb7070 'UIView-Encapsulated-Layout-Height' MesComptes.MCAgenciesSearchDetailHoursWidgetsView:0x7fc0160f2380.height == 0   (active)>",
    "<NSLayoutConstraint:0x600003c694f0 'UIViewSafeAreaLayoutGuide-bottom' V:[UILayoutGuide:0x6000025678e0'UIViewSafeAreaLayoutGuide']-(0)-|   (active, names: '|':MesComptes.PhoneWidgetView:0x7fc0160d0d70 )>",
    "<NSLayoutConstraint:0x600003c6a580 'UIViewSafeAreaLayoutGuide-top' V:|-(0)-[UILayoutGuide:0x6000025678e0'UIViewSafeAreaLayoutGuide']   (active, names: '|':MesComptes.PhoneWidgetView:0x7fc0160d0d70 )>"
)

Incorrect parsing for named views

I set the accessibilityIdentifier for a UIView and the constraint error looks like this (trimmed):

(
    "<NSLayoutConstraint:0x17468b860 progress background.height == 5   (active, names: progress background:0x1089a5290 )>"
)

and it crashed with:

UNEXPECTED INPUT:
Line 2, Column 46
    "<NSLayoutConstraint:0x17468b860 progress background.height == 5   (active, names: progress background:0x1089a5290 )>"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
EXPECTED:
':'
'.'

Parsing Issues

My app is a Cocoa app and the constraints are based on AppKit.

Input No. 1:

(
    "<NSLayoutConstraint:0x6000025f4c30 'GridView.bottom_containment' (NSGridView:0x7fbc23ce8660.row-boundary+((NSGridView:0x7fbc23ce8660.row-boundary-6) - NSGridView:0x7fbc23ce8660.row-boundary)) >= NSTextField:0x7fbc23cf1680.bottom   (active, names: NSGridView:0x7fbc23ce8660.row-boundary:0x600001d5a240, NSGridView:0x7fbc23ce8660.row-boundary:0x600001d40200 )>",
    "<NSLayoutConstraint:0x6000025f5180 'GridView_Y_centering' (NSGridView:0x7fbc23ce8660.row-boundary+0.5*(NSGridView:0x7fbc23ce8660.bottom - NSGridView:0x7fbc23ce8660.row-boundary)) == HacKit.BadgeView:0x7fbc23ce83e0.centerY   (active, names: NSGridView:0x7fbc23ce8660.row-boundary:0x600001d40200, NSGridView:0x7fbc23ce8660.bottom:0x600001d44200 )>",
    "<NSLayoutConstraint:0x6000025f4730 'GridView_bottom_placement' (NSGridView:0x7fbc23ce8660.top+((NSGridView:0x7fbc23ce8660.row-boundary-6) - NSGridView:0x7fbc23ce8660.top)) == NSImageView:0x7fbc23cf0ea0.bottom   (active, names: NSGridView:0x7fbc23ce8660.top:0x600001d44ec0, NSGridView:0x7fbc23ce8660.row-boundary:0x600001d5a240 )>",
    "<NSLayoutConstraint:0x6000025f51d0 'GridView.top_containment' NSGridView:0x7fbc23ce8660.row-boundary <= HacKit.BadgeView:0x7fbc23ce83e0.top   (active)>",
    "<NSLayoutConstraint:0x6000025f4f00 NSTextField:0x7fbc23cf1680.firstBaseline == NSSlider:0x7fbc23cf1b10.firstBaseline   (active)>",
    "<NSLayoutConstraint:0x6000025f4780 'GridView.top_containment' NSGridView:0x7fbc23ce8660.top <= NSImageView:0x7fbc23cf0ea0.top   (active)>",
    "<NSLayoutConstraint:0x60000258fca0 V:|-(NSSpace(20))-[NSGridView:0x7fbc23ce8660]   (active, names: '|':NSView:0x7fbc23ce88f0 )>",
    "<NSLayoutConstraint:0x60000258fcf0 V:[NSGridView:0x7fbc23ce8660]-(NSSpace(20))-|   (active, names: '|':NSView:0x7fbc23ce88f0 )>",
    "<NSAutoresizingMaskLayoutConstraint:0x6000025f57c0 h=-&- v=-&- NSView:0x7fbc23ce88f0.minY == - 1   (active, names: '|':NSBox:0x7fbc23ce8b30'Story' )>",
    "<NSAutoresizingMaskLayoutConstraint:0x6000025f5810 h=-&- v=-&- V:|-(15)-[NSView:0x7fbc23ce88f0]   (active, names: '|':NSBox:0x7fbc23ce8b30'Story' )>",
    "<NSLayoutConstraint:0x60000258fa20 V:[NSBox:0x7fbc23ce8b30'Story']-(NSSpace(20))-|   (active, names: '|':NSView:0x7fbc23ce8de0 )>",
    "<NSAutoresizingMaskLayoutConstraint:0x6000025a2a30 h=--& v=--& NSView:0x7fbc23ce8de0.height == 167   (active)>",
    "<NSLayoutConstraint:0x60000258f9d0 V:[NSBox:0x7fbc23ce9020'Stories List']-(NSSpace(8))-[NSBox:0x7fbc23ce8b30'Story']   (active)>",
    "<NSLayoutConstraint:0x60000258f980 V:|-(NSSpace(20))-[NSBox:0x7fbc23ce9020'Stories List']   (active, names: '|':NSView:0x7fbc23ce8de0 )>",
    "<NSLayoutConstraint:0x60000258f840 NSBox:0x7fbc23ce9020'Stories List'.height == 89   (active)>",
    "<NSLayoutConstraint:0x6000025f4f50 'GridView.top_containment' NSGridView:0x7fbc23ce8660.row-boundary <= NSSlider:0x7fbc23cf1b10.top   (active)>"
)

Output:

Line 2, Column 71
    "<NSLayoutConstraint:0x6000025f4c30 'GridView.bottom_containment' (NSGridView:0x7fbc23ce8660.row-boundary+((NSGridView:0x7fbc23ce8660.row-boundary-6) - NSGridView:0x7fbc23ce8660.row-boundary)) >= NSTextField:0x7fbc23cf1680.bottom   (active, names: NSGridView:0x7fbc23ce8660.row-boundary:0x600001d5a240, NSGridView:0x7fbc23ce8660.row-boundary:0x600001d40200 )>",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Expected: whitespace in constraint instance
Expected: whitespace
Expected: ':' in instance
Expected: valid class name character in instance
Expected: '.' in dot attribute
Expected: valid partial identifier character
Expected: 'H'
Expected: 'V'

Input No. 2:

(
    "<NSLayoutConstraint:0x6000025f4c30 'GridView.bottom_containment' (NSGridView:0x7fbc23ce8660.row-boundary+((NSGridView:0x7fbc23ce8660.row-boundary-6) - NSGridView:0x7fbc23ce8660.row-boundary)) >= NSTextField:0x7fbc23cf1680.bottom   (active, names: NSGridView:0x7fbc23ce8660.row-boundary:0x600001d5a240, NSGridView:0x7fbc23ce8660.row-boundary:0x600001d40200 )>",
    "<NSLayoutConstraint:0x6000025f5180 'GridView_Y_centering' (NSGridView:0x7fbc23ce8660.row-boundary+0.5*(NSGridView:0x7fbc23ce8660.bottom - NSGridView:0x7fbc23ce8660.row-boundary)) == HacKit.BadgeView:0x7fbc23ce83e0.centerY   (active, names: NSGridView:0x7fbc23ce8660.row-boundary:0x600001d40200, NSGridView:0x7fbc23ce8660.bottom:0x600001d44200 )>",
    "<NSLayoutConstraint:0x6000025f51d0 'GridView.top_containment' NSGridView:0x7fbc23ce8660.row-boundary <= HacKit.BadgeView:0x7fbc23ce83e0.top   (active)>",
    "<NSLayoutConstraint:0x6000025f4f00 NSTextField:0x7fbc23cf1680.firstBaseline == NSSlider:0x7fbc23cf1b10.firstBaseline   (active)>",
    "<NSLayoutConstraint:0x60000258fca0 V:|-(NSSpace(20))-[NSGridView:0x7fbc23ce8660]   (active, names: '|':NSView:0x7fbc23ce88f0 )>",
    "<NSLayoutConstraint:0x60000258fcf0 V:[NSGridView:0x7fbc23ce8660]-(NSSpace(20))-|   (active, names: '|':NSView:0x7fbc23ce88f0 )>",
    "<NSAutoresizingMaskLayoutConstraint:0x6000025f57c0 h=-&- v=-&- NSView:0x7fbc23ce88f0.minY == - 1   (active, names: '|':NSBox:0x7fbc23ce8b30'Story' )>",
    "<NSAutoresizingMaskLayoutConstraint:0x6000025f5810 h=-&- v=-&- V:|-(15)-[NSView:0x7fbc23ce88f0]   (active, names: '|':NSBox:0x7fbc23ce8b30'Story' )>",
    "<NSLayoutConstraint:0x60000258fa20 V:[NSBox:0x7fbc23ce8b30'Story']-(NSSpace(20))-|   (active, names: '|':NSView:0x7fbc23ce8de0 )>",
    "<NSAutoresizingMaskLayoutConstraint:0x6000025a2a30 h=--& v=--& NSView:0x7fbc23ce8de0.height == 167   (active)>",
    "<NSLayoutConstraint:0x60000258f9d0 V:[NSBox:0x7fbc23ce9020'Stories List']-(NSSpace(8))-[NSBox:0x7fbc23ce8b30'Story']   (active)>",
    "<NSLayoutConstraint:0x60000258f980 V:|-(NSSpace(20))-[NSBox:0x7fbc23ce9020'Stories List']   (active, names: '|':NSView:0x7fbc23ce8de0 )>",
    "<NSLayoutConstraint:0x60000258f840 NSBox:0x7fbc23ce9020'Stories List'.height == 89   (active)>",
    "<NSLayoutConstraint:0x6000025f4f50 'GridView.top_containment' NSGridView:0x7fbc23ce8660.row-boundary <= NSSlider:0x7fbc23cf1b10.top   (active)>",
    "<NSLayoutConstraint:0x6000025f4a00 'GridView.top_containment' NSGridView:0x7fbc23ce8660.top <= NSImageView:0x7fbc23cf1290.top   (active)>",
    "<NSLayoutConstraint:0x6000025f4960 'GridView_bottom_placement' (NSGridView:0x7fbc23ce8660.top+((NSGridView:0x7fbc23ce8660.row-boundary-6) - NSGridView:0x7fbc23ce8660.top)) == NSImageView:0x7fbc23cf1290.bottom   (active, names: NSGridView:0x7fbc23ce8660.top:0x600001d44ec0, NSGridView:0x7fbc23ce8660.row-boundary:0x600001d5a240 )>"
)

Output:

Line 2, Column 71
    "<NSLayoutConstraint:0x6000025f4c30 'GridView.bottom_containment' (NSGridView:0x7fbc23ce8660.row-boundary+((NSGridView:0x7fbc23ce8660.row-boundary-6) - NSGridView:0x7fbc23ce8660.row-boundary)) >= NSTextField:0x7fbc23cf1680.bottom   (active, names: NSGridView:0x7fbc23ce8660.row-boundary:0x600001d5a240, NSGridView:0x7fbc23ce8660.row-boundary:0x600001d40200 )>",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Expected: whitespace in constraint instance
Expected: whitespace
Expected: ':' in instance
Expected: valid class name character in instance
Expected: '.' in dot attribute
Expected: valid partial identifier character
Expected: 'H'
Expected: 'V'

Input No. 3:

(
    "<NSLayoutConstraint:0x60000258f840 NSBox:0x7fbc23ce9020'Stories List'.height == 89   (active)> (Actual Distance - pixels):178"
)

Output:

Line 2, Column 100
    "<NSLayoutConstraint:0x60000258f840 NSBox:0x7fbc23ce9020'Stories List'.height == 89   (active)> (Actual Distance - pixels):178"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Expected: '"' in >"

The last input is based on me clicking on the orange vertical line.

Screenshot 2021-04-29 at 5 55 32 PM

Preserve constraint identifiers

First off — thank you for making this site; it's invaluable in getting a parsable breakdown of constraint resolution errors!

Something I noticed is that constraint identifiers are completely lost in the output, which (if you are using them) is quite the loss. Keeping them in would help a lot in determining what constraints are being set where, belong to what groups, etc. etc.

(Thanks again!)

Parse issue

input:

(
    "<NSLayoutConstraint:0x60000012ddb0 H:|-(0)-[UIStackView:0x7ff97e680770]   (active, names: '|':_TtGC10ModuleName16RefinedStackViewCSo6UIView_:0x7ff97e6805d0 )>",
    "<NSLayoutConstraint:0x600000114d70 UIView:0x7ff97e604940.width == 1   (active)>",
    "<NSLayoutConstraint:0x6000001180f0 (_TtGC10ModuleName16RefinedStackViewCSo6UIView_:0x7ff97e6805d0.leading - UILayoutGuide:0x600001b61c00'ModuleName.CustomLayoutGuide1'.leading) == 0.5*(UIView:0x7ff97e6ae5f0.leading - UIView:0x7ff97e604940.trailing)   (active, names: _TtGC10ModuleName16RefinedStackViewCSo6UIView_:0x7ff97e6805d0.leading:0x600003736480, UILayoutGuide:0x600001b61c00'ModuleName.CustomLayoutGuide1'.leading:0x600003734380, UIView:0x7ff97e6ae5f0.leading:0x60000386dc40, UIView:0x7ff97e604940.trailing:0x60000386dc00 )>",
    "<NSLayoutConstraint:0x60000012d680 H:|-(0)-[UILayoutGuide:0x600001b62a00'ModuleName.CustomLayoutGuide2']   (active, names: '|':ModuleName.CustomView1:0x7ff97e6803f0 )>",
    "<NSLayoutConstraint:0x60000012cb90 H:|-(0)-[UILayoutGuide:0x600001b61c00'ModuleName.CustomLayoutGuide1']   (active, names: '|':ModuleName.CustomView1:0x7ff97e6803f0 )>",
    "<NSLayoutConstraint:0x60000011a940 UILayoutGuide:0x600001b62a00'ModuleName.CustomLayoutGuide2'.leading == CustomView2:0x7ff98014d050.leading   (active)>",
    "<NSLayoutConstraint:0x60000011aa30 CustomView2:0x7ff98014d050.leading == UIView:0x7ff97e6ae5f0.leading   (active)>",
    "<NSLayoutConstraint:0x600000116030 'UISV-canvas-connection' UIStackView:0x7ff97e680770.leading == UIView:0x7ff97e604940.leading   (active)>",
    "<NSLayoutConstraint:0x600000116120 'UISV-distributing-edge' H:[UIView:0x7ff97e604940]-(0)-[_UIOLAGapGuide:0x600001e69100'UISV-distributing']   (active)>",
    "<NSLayoutConstraint:0x600000116170 'UISV-distributing-edge' _UIOLAGapGuide:0x600001e69100'UISV-distributing'.trailing == UIView:0x7ff97e6ae5f0.leading   (active)>"
)

output:

Line 4, Column 41
    "<NSLayoutConstraint:0x6000001180f0 (_TtGC10ModuleName16RefinedStackViewCSo6UIView_:0x7ff97e6805d0.leading - UILayoutGuide:0x600001b61c00'ModuleName.CustomLayoutGuide1'.leading) == 0.5*(UIView:0x7ff97e6ae5f0.leading - UIView:0x7ff97e604940.trailing)   (active, names: _TtGC10ModuleName16RefinedStackViewCSo6UIView_:0x7ff97e6805d0.leading:0x600003736480, UILayoutGuide:0x600001b61c00'ModuleName.CustomLayoutGuide1'.leading:0x600003734380, UIView:0x7ff97e6ae5f0.leading:0x60000386dc40, UIView:0x7ff97e604940.trailing:0x60000386dc00 )>",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Expected: whitespace in constraint instance
Expected: 'h' in constraint instance.autoresizing mask info.h=
Expected: ''' in constraint instance.identifier
Expected: whitespace
Expected: ':' in instance
Expected: valid class name character in instance
Expected: '.' in dot attribute
Expected: valid partial identifier character
Expected: 'H'
Expected: 'V'

I'm using -[NSLayoutXAxisAnchor anchorWithOffsetToAnchor:], that seems to be the line the parser can't handle

Parse error for constraint multipliers

Example input:

(
"<NSLayoutConstraint:0x167e8dd10 UIImageView:0x167e89f20.centerX == ServiceTypeCarouselItemView:0x167e89d20.centerX>",
"<NSLayoutConstraint:0x167e8ddb0 UIImageView:0x167e89f20.width == ServiceTypeCarouselItemView:0x167e89d20.width * 0.7>",
"<NSLayoutConstraint:0x167e8de00 UILabel:0x167e8a1c0.leading >= ServiceTypeCarouselItemView:0x167e89d20.leading + 5>",
"<NSLayoutConstraint:0x167e8dea0 UILabel:0x167e8a1c0.centerX == UIImageView:0x167e89f20.centerX>",
"<NSLayoutConstraint:0x167e8e8b0 UIImageView:0x167e89f20.width == ServiceTypeCarouselItemView:0x167e89d20.width * 0.8>"
)

Output:
UNEXPECTED INPUT:
Line 4, Column 117
"<NSLayoutConstraint:0x167e8ddb0 UIImageView:0x167e89f20.width == ServiceTypeCarouselItemView:0x167e89d20.width * 0.7>",

EXPECTED:
'('
whitespace
'+' in +
'-' in -
'>' in >"

Custom naming of views

Instead of View1 or View2, it would be neat if we could change it to something easy to remember. Right now I have to write down the memory address of view1, launch the view debugger and cross reference the address from wtfautolayout to find out that view1 actually is CustomHeaderView. For a couple views its pretty easy, but gets difficult as more views are on the screen.

Support leftMargin

Thanks a ton for fixing that issue yesterday! It seems leftMargin and rightMargin are also not supported yet (though I should probably remove those from my own code...):

(
    "<NSLayoutConstraint:0x170490e00 UIScrollView:0x1241d1200.left == LingQ.LQScrollingStackView:0x123ed1070.left>",
    "<NSLayoutConstraint:0x170490ea0 UIScrollView:0x1241d1200.right == LingQ.LQScrollingStackView:0x123ed1070.right>",
    "<SnapKit.LayoutConstraint:[email protected]#222 LingQ.LQScrollingStackView:0x123ed1070.left == NSKVONotifying_LQRoundedCornerView:0x123d8da90.leftMargin>",
    "<SnapKit.LayoutConstraint:[email protected]#222 LingQ.LQScrollingStackView:0x123ed1070.right == NSKVONotifying_LQRoundedCornerView:0x123d8da90.rightMargin>",
    "<SnapKit.LayoutConstraint:[email protected]#203 UIImageView:0x123d8e1f0.width == NSKVONotifying_LQRoundedCornerView:0x123d8da90.width * 0.25>",
    "<NSLayoutConstraint:0x1742812c0 LingQ.LLBadgeView:0x123d8e020.trailing == _UILayoutSpacer:0x1743a0620.trailing>",
    "<NSLayoutConstraint:0x174281450 LingQ.LLBadgeView:0x123d8e020.centerX == UIImageView:0x123d8e1f0.centerX>",
    "<NSLayoutConstraint:0x1704918f0 LingQ.LLBadgeView:0x123d8e020.width == 0>",
    "<NSLayoutConstraint:0x174281400 _UILayoutSpacer:0x1743a0620.trailing >= UIImageView:0x123d8e1f0.trailing>"
)
UNEXPECTED INPUT:
Line 4, Column 172
    "<SnapKit.LayoutConstraint:[email protected]#222 LingQ.LQScrollingStackView:0x123ed1070.left == NSKVONotifying_LQRoundedCornerView:0x123d8da90.leftMargin>",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
EXPECTED:
whitespace
digit or whitespace in number
'*' in *
'+' in +
whitespace or '(' in info
'>' in >"
'-' in -

Cannot Parse _UISystemBaselineConstraint

Input

"<NSLayoutConstraint:0x60000346c9b0 UITextField:0x7fa67503ae00.height == 50   (active)>",
    "<NSLayoutConstraint:0x60000346d720 V:|-(0)-[UITextField:0x7fa67503ae00]   (active, names: '|':UIView:0x7fa67350cab0 )>",
    "<NSLayoutConstraint:0x60000346d7c0 V:[UITextField:0x7fa67503ae00]-(0)-|   (active, names: '|':UIView:0x7fa67350cab0 )>",
    "<NSLayoutConstraint:0x60000346dbd0 UITableViewCellContentView:0x7fa67350b050.bottomMargin == UIStackView:0x7fa67350c480.bottom   (active)>",
    "<NSLayoutConstraint:0x60000346dc20 UIStackView:0x7fa67350c480.top == UITableViewCellContentView:0x7fa67350b050.topMargin   (active)>",
    "<NSLayoutConstraint:0x600003459680 'UISV-alignment' UIImageView:0x7fa67350c880.centerY == UIView:0x7fa67350cab0.centerY   (active)>",
    "<NSLayoutConstraint:0x60000345ac10 'UISV-canvas-connection' UIStackView:0x7fa67350c680.top == _UILayoutSpacer:0x60000284c1e0'UISV-alignment-spanner'.top   (active)>",
    "<NSLayoutConstraint:0x60000345a440 'UISV-canvas-connection' UIStackView:0x7fa67350c680.centerY == UIImageView:0x7fa67350c880.centerY   (active)>",
    "<NSLayoutConstraint:0x600003458320 'UISV-canvas-connection' UIStackView:0x7fa67350c480.top == UIStackView:0x7fa67350c680.top   (active)>",
    "<NSLayoutConstraint:0x6000034757c0 'UISV-canvas-connection' V:[UIButton:0x7fa67350bf50'E-posta adresini mi unutt...']-(0)-|   (active, names: '|':UIStackView:0x7fa67350c480 )>",
    "<_UISystemBaselineConstraint:0x6000033499e0 'UISV-spacing' V:[UIStackView:0x7fa67350c680]-(NSLayoutAnchorConstraintSpace(8))-[UIButton:0x7fa67350bf50'E-posta adresini mi unutt...']   (active)>",
    "<NSLayoutConstraint:0x6000034679d0 'UISV-spanning-boundary' _UILayoutSpacer:0x60000284c1e0'UISV-alignment-spanner'.top <= UIView:0x7fa67350cab0.top   (active)>",
    "<NSLayoutConstraint:0x60000346ddb0 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x600002e401c0'UIViewLayoutMarginsGuide']-(8)-|   (active, names: '|':UITableViewCellContentView:0x7fa67350b050 )>",
    "<NSLayoutConstraint:0x60000346d590 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7fa67350b050.height == 66   (active)>",
    "<NSLayoutConstraint:0x60000346dd10 'UIView-topMargin-guide-constraint' V:|-(8)-[UILayoutGuide:0x600002e401c0'UIViewLayoutMarginsGuide']   (active, names: '|':UITableViewCellContentView:0x7fa67350b050 )>"

Output

UNEXPECTED INPUT:
Line 11, Column 99
    "<_UISystemBaselineConstraint:0x6000033499e0 'UISV-spacing' V:[UIStackView:0x7fa67350c680]-(NSLayoutAnchorConstraintSpace(8))-[UIButton:0x7fa67350bf50'E-posta adresini mi unutt...']   (active)>",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
EXPECTED:
'S' in NSSpace

Issue Running Project on Localhost - M1 MacBook ,Type 'StaticString' does not conform to protocol 'Collection'

I'm encountering an error while attempting to run the project on my M1 MacBook using localhost. The specific error message I'm receiving is:
Type 'StaticString' does not conform to protocol 'Collection'
I'm wondering if anyone else has faced a similar issue while trying to run the project. If you've come across this error or have experienced something similar, your insights would be greatly appreciated.
If anyone has successfully resolved this issue or has any suggestions on how to address it, I'd be grateful for your assistance. Any information or guidance would be valuable in helping me get the project up and running on my device
Screenshot 2023-08-24 at 4 07 04 PM
.

Thank you in advance for your help!

Issue parsing _UISystemBaselineConstraint

Input:

(
    "<_UISystemBaselineConstraint:0x2828051d0 V:|-(>=NSLayoutAnchorConstraintSpace(8))-[UILabel:0x111b35c20]   (active, names: '|':ModuleName.ClassName:0x111b35a60 )>",
    "<NSLayoutConstraint:0x282805130 UILabel:0x111b35c20.centerY == ModuleName.ClassName:0x111b35a60.centerY   (active)>",
    "<NSLayoutConstraint:0x282803ed0 'UIView-Encapsulated-Layout-Height' ModuleName.ClassName:0x111b35a60.height == 0   (active)>"
)

Error message:

Line 2, Column 54
    "<_UISystemBaselineConstraint:0x2828051d0 V:|-(>=NSLayoutAnchorConstraintSpace(8))-[UILabel:0x111b35c20]   (active, names: '|':ModuleName.ClassName:0x111b35a60 )>",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Expected: '+' in number.+
Expected: '-' in number.-
Expected: whitespace in number
Expected: digit in number

It would be nice to also parse `po view.constraints`

It has a similar output but a different style. I think it's not that hard to add this parsing option.

 - 0 : <NSLayoutConstraint:0x6000035b77a0 UILayoutGuide:0x600002fe0e00''.centerY == UIFoundation.TitleSubtitleView:0x7f909a93c110.centerY   (active)>
  - 1 : <NSLayoutConstraint:0x6000035b7750 H:|-(0)-[UILayoutGuide:0x600002fe0e00'']   (active, names: '|':UIFoundation.TitleSubtitleView:0x7f909a93c110 )>
  - 2 : <NSLayoutConstraint:0x6000035b77f0 UILayoutGuide:0x600002fe0e00''.trailing == UIFoundation.TitleSubtitleView:0x7f909a93c110.trailing   (active)>
  - 3 : <NSLayoutConstraint:0x6000035b7840 V:|-(>=0)-[UILayoutGuide:0x600002fe0e00'']   (active, names: '|':UIFoundation.TitleSubtitleView:0x7f909a93c110 )>
  - 4 : <NSLayoutConstraint:0x6000035b7890 V:|-(0@250)-[UILayoutGuide:0x600002fe0e00''] priority:250   (active, names: '|':UIFoundation.TitleSubtitleView:0x7f909a93c110 )>
  - 5 : <NSLayoutConstraint:0x6000035b78e0 UILayoutGuide:0x600002fe0ee0''.top == UILayoutGuide:0x600002fe0e00''.top + 12   (active)>

I created a regex that helps but not convenient - https://regex101.com/r/NkATVe/1

Also it is a problem with 4-th expression where used priorities.

Expanded message for `UIView-Encapsulated-Layout` constraints

UIView-Encapsulated-Layout-* constraints are commonly added by collection views et al, but are also the resultant constraints from translatesAutoresizingMaskIntoConstraints. In projects where constraints are being added to old frame-based layouts, knowing this can be really helpful.

Labels with contractions fail to render

If a UILabel has text that contains an apostrophe the parser fails with:

UNEXPECTED INPUT:
...
EXPECTED:
']'

Example:

(
    "<NSLayoutConstraint:0x600000688070 UIView:0x7fcae969d920.height == 50   (active)>",
    "<NSLayoutConstraint:0x600000688700 V:[MyApp.UIButton:0x7fcae969f500'No Thanks']-(0)-|   (active, names: '|':UIView:0x7fcae969f320 )>",
    "<NSLayoutConstraint:0x6000006887a0 V:|-(0)-[MyApp.UIButton:0x7fcae969f500'No Thanks']   (active, names: '|':UIView:0x7fcae969f320 )>",
    "<NSLayoutConstraint:0x600000688b10 V:|-(10)-[MyApp.UILabel:0x7fcae969ece0'Keep track of your friend's ...']   (active, names: '|':UIView:0x7fcae969eb00 )>",
    "<NSLayoutConstraint:0x600000688bb0 V:[MyApp.UILabel:0x7fcae969ece0'Keep track of your friend's ...']-(15)-[UIView:0x7fcae969f320]   (active)>",
    "<NSLayoutConstraint:0x600000688c00 V:[UIView:0x7fcae969f320]-(15)-|   (active, names: '|':UIView:0x7fcae969eb00 )>",
    "<NSLayoutConstraint:0x600000688e80 V:[UIStackView:0x7fcae969d720]-(0)-|   (active, names: '|':UITableViewCellContentView:0x7fcae969d530 )>",
    "<NSLayoutConstraint:0x600000688f20 V:|-(0)-[UIStackView:0x7fcae969d720]   (active, names: '|':UITableViewCellContentView:0x7fcae969d530 )>",
    "<NSLayoutConstraint:0x600000688f70 'UISV-canvas-connection' UIStackView:0x7fcae969d720.top == UIView:0x7fcae969d920.top   (active)>",
    "<NSLayoutConstraint:0x600000689060 'UISV-canvas-connection' V:[UIView:0x7fcae969eb00]-(0)-|   (active, names: '|':UIStackView:0x7fcae969d720 )>",
    "<NSLayoutConstraint:0x6000006890b0 'UISV-spacing' V:[UIView:0x7fcae969d920]-(0)-[UIView:0x7fcae969eb00]   (active)>",
    "<NSLayoutConstraint:0x60400048fd20 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7fcae969d530.height == 50   (active)>"
)

if you change friend's to friends the parser is again able to handle the input

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.