Rightpoint / Eject

An eject button for Interface Builder to generate swift code
MIT License
522 stars 24 forks source link

Support Safe Area Layout Guide #38

Open mattwyskiel opened 6 years ago

mattwyskiel commented 6 years ago

So I ran Eject on my .xib and got this output:

document.objects.view.subviews.view: insetsLayoutMarginsFromSafeArea='NO'                                                                                                         
document.objects.view.subviews.view: insetsLayoutMarginsFromSafeArea='NO'                                                                                                         
Can not configure XML nodes 'viewLayoutGuide'                                                                                                                                     
Can not configure XML nodes 'point'                                                                                                                                               
Variable 'imageView: UIImageView' was generated 2 times. // <-- specific to my project                                                                                                                          
Error: invalidReference("2kL-IL-xdO")   

It appears that the program is unable to support constraints against the safe area layout guide, added in iOS 11.

Here is the relevant source from the xib file:

// ...
<constraints>
     <constraint firstItem="2kL-IL-xdO" firstAttribute="bottom" secondItem="Zi3-cc-4t5" secondAttribute="bottom" constant="20" id="8U4-yK-lhp"/>
     <constraint firstItem="2kL-IL-xdO" firstAttribute="bottom" secondItem="3i5-rT-P9f" secondAttribute="bottom" constant="20" id="8Wl-FC-8aX"/>
     <constraint firstItem="tBV-wJ-bHs" firstAttribute="leading" secondItem="2kL-IL-xdO" secondAttribute="leading" constant="16" id="DYw-JW-42g"/>
     <constraint firstItem="2kL-IL-xdO" firstAttribute="trailing" secondItem="3i5-rT-P9f" secondAttribute="trailing" constant="20" id="FKk-5J-rwC"/>
     <constraint firstItem="2kL-IL-xdO" firstAttribute="trailing" secondItem="iI4-J5-UpK" secondAttribute="trailing" constant="89" id="G2d-aF-bYk"/>
     <constraint firstItem="Zi3-cc-4t5" firstAttribute="leading" secondItem="2kL-IL-xdO" secondAttribute="leading" constant="20" id="Kas-ql-tKM"/>
     <constraint firstItem="tBV-wJ-bHs" firstAttribute="top" secondItem="5C9-QY-uP2" secondAttribute="bottom" constant="-1" id="KoW-CI-mIs"/>
     <constraint firstItem="W73-W8-5S3" firstAttribute="centerX" secondItem="2kL-IL-xdO" secondAttribute="centerX" id="KrG-m9-qvT"/>
     <constraint firstAttribute="trailing" secondItem="YHR-GC-tiW" secondAttribute="trailing" id="LdH-1r-g0g"/>
     <constraint firstItem="5C9-QY-uP2" firstAttribute="top" secondItem="ADU-wZ-6Mx" secondAttribute="bottom" constant="14" id="QjB-0e-Cdv"/>
     <constraint firstItem="ADU-wZ-6Mx" firstAttribute="leading" secondItem="2kL-IL-xdO" secondAttribute="leading" id="R8u-cw-6KD"/>
     <constraint firstAttribute="bottom" secondItem="YHR-GC-tiW" secondAttribute="bottom" id="Tf1-zr-ncU"/>
     <constraint firstItem="iI4-J5-UpK" firstAttribute="top" secondItem="2kL-IL-xdO" secondAttribute="top" constant="45" id="UQW-Lt-gTE"/>
     <constraint firstItem="ADU-wZ-6Mx" firstAttribute="top" secondItem="W73-W8-5S3" secondAttribute="bottom" constant="8" id="YKH-bV-GFb"/>
     <constraint firstItem="YHR-GC-tiW" firstAttribute="top" secondItem="977-Kl-DqP" secondAttribute="top" id="YaX-ba-BQb"/>
     <constraint firstItem="2kL-IL-xdO" firstAttribute="trailing" secondItem="tBV-wJ-bHs" secondAttribute="trailing" constant="16" id="Ycl-6J-UBO"/>
     <constraint firstItem="iI4-J5-UpK" firstAttribute="leading" secondItem="2kL-IL-xdO" secondAttribute="leading" constant="90" id="e8a-kC-VxY"/>
     <constraint firstItem="YHR-GC-tiW" firstAttribute="leading" secondItem="977-Kl-DqP" secondAttribute="leading" id="h0W-Wq-OnG"/>
     <constraint firstItem="2kL-IL-xdO" firstAttribute="trailing" secondItem="ADU-wZ-6Mx" secondAttribute="trailing" id="klO-yT-vIA"/>
     <constraint firstItem="W73-W8-5S3" firstAttribute="top" secondItem="iI4-J5-UpK" secondAttribute="bottom" constant="27" id="lAV-H5-8eZ"/>
     <constraint firstItem="3i5-rT-P9f" firstAttribute="top" relation="greaterThanOrEqual" secondItem="tBV-wJ-bHs" secondAttribute="bottom" id="pJ9-Cb-772"/>
     <constraint firstItem="2kL-IL-xdO" firstAttribute="trailing" secondItem="5C9-QY-uP2" secondAttribute="trailing" constant="16" id="pUr-Fw-BIK"/>
     <constraint firstItem="iI4-J5-UpK" firstAttribute="centerX" secondItem="2kL-IL-xdO" secondAttribute="centerX" id="rbI-JP-9gZ"/>
     <constraint firstItem="5C9-QY-uP2" firstAttribute="leading" secondItem="2kL-IL-xdO" secondAttribute="leading" constant="16" id="wE1-MW-VkO"/>
</constraints>
// ...
<viewLayoutGuide key="safeArea" id="2kL-IL-xdO"/>
// ...

This is all under the root view in the hierarchy.

KingOfBrian commented 6 years ago

Hey @mattwyskiel -- thanks for the bug! I'm pretty swamped right now, but will try to get to it soon.