Morgan Wilde
Morgan Wilde

Reputation: 17303

How does Xcode generate the values for id attributes inside storyboard files?

For example, this is some code from a .storyboard file.

<scene sceneID="iia-3d-rxc">
    <objects>
        <viewController id="diG-vY-mTj" sceneMemberID="viewController">
            <layoutGuides>
                <viewControllerLayoutGuide type="top" id="doE-rD-hZg"/>
                <viewControllerLayoutGuide type="bottom" id="a3z-Fu-YSa"/>
            </layoutGuides>
            <view key="view" contentMode="scaleToFill" id="osR-Fj-lTh">
            <!-- ... -->
            </view>
        </viewController>
        <placeholder placeholderIdentifier="IBFirstResponder" id="ywT-Gm-hlb" userLabel="First Responder" sceneMemberID="firstResponder"/>
    </objects>
    <point key="canvasLocation" x="736" y="439"/>
</scene>

Every single node has an id attribute of the format ***-**-***, where the stars are substituted with alphanumeric symbols.

What sort of format is this? What's the purpose of those id attributes and how are they generated?

Upvotes: 4

Views: 262

Answers (2)

Charles Thomas
Charles Thomas

Reputation: 1005

I have a hard time believing that these identities are randomly generated, since it would require unnecessary lookup tables during compilation. Take, for example the identity "orR-Rm-srM". It appears to be a base-62 number with each digit being a-zA-Z0-9. Giving us 8 62-value "bits".

Tom

Upvotes: 1

Tom Kidd
Tom Kidd

Reputation: 12908

Everything I've seen says they're basically random.

Upvotes: 0

Related Questions