mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-05 11:48:10 +00:00
Use manual cell layout in timeline.
This commit is contained in:
1 parent
46d3240cd1
commit
4bbe6d3557
11 files changed
+720
-963
No files matched your search
@@ -128,316 +128,6 @@
|
||||
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
</collectionViewFlowLayout>
|
||||
<cells>
|
||||
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="MainTimelineCellIndexZero" id="mnV-bT-V2W" customClass="MainTimelineCollectionViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="8" y="0.0" width="386" height="52"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<collectionViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="FbB-Hl-Eg2">
|
||||
<rect key="frame" x="0.0" y="0.0" width="386" height="52"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1d5-Y3-Op5">
|
||||
<rect key="frame" x="12" y="0.0" width="362" height="1"/>
|
||||
<color key="backgroundColor" systemColor="separatorColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="mkk-77-j8h"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Uqs-BQ-GEC" customClass="IconView" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="12" y="8" width="16" height="16"/>
|
||||
<color key="backgroundColor" systemColor="secondarySystemBackgroundColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="16" id="g1s-7i-04d"/>
|
||||
<constraint firstAttribute="width" constant="16" id="gXY-FG-2Qp"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Article Content" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Yan-r6-V5Z">
|
||||
<rect key="frame" x="36" y="5.9999999999999982" width="338" height="20.333333333333329"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" alignment="center" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="5Fg-Tr-Kiy">
|
||||
<rect key="frame" x="36" y="28.333333333333332" width="338" height="14.333333333333332"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="authorByLine" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="o3c-FZ-gKE">
|
||||
<rect key="frame" x="0.0" y="0.0" width="168" height="14.333333333333334"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
|
||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="articleDate" textAlignment="right" lineBreakMode="wordWrap" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aGY-Xq-5YU">
|
||||
<rect key="frame" x="170" y="0.0" width="168" height="14.333333333333334"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
|
||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</stackView>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="Ryd-OQ-Nok"/>
|
||||
<constraints>
|
||||
<constraint firstItem="1d5-Y3-Op5" firstAttribute="leading" secondItem="Uqs-BQ-GEC" secondAttribute="leading" id="Dmm-92-ZH9"/>
|
||||
<constraint firstItem="Yan-r6-V5Z" firstAttribute="top" secondItem="Ryd-OQ-Nok" secondAttribute="top" constant="6" id="HuG-h3-H5d"/>
|
||||
<constraint firstItem="1d5-Y3-Op5" firstAttribute="trailing" secondItem="Yan-r6-V5Z" secondAttribute="trailing" id="Kq1-la-WyU"/>
|
||||
<constraint firstItem="Uqs-BQ-GEC" firstAttribute="leading" secondItem="Ryd-OQ-Nok" secondAttribute="leading" constant="12" id="M2Z-pj-PbV"/>
|
||||
<constraint firstItem="Ryd-OQ-Nok" firstAttribute="trailing" secondItem="5Fg-Tr-Kiy" secondAttribute="trailing" constant="12" id="MD2-yi-tQF"/>
|
||||
<constraint firstItem="Ryd-OQ-Nok" firstAttribute="bottom" secondItem="5Fg-Tr-Kiy" secondAttribute="bottom" constant="9.3333333333333357" id="NBZ-iq-pvJ"/>
|
||||
<constraint firstItem="5Fg-Tr-Kiy" firstAttribute="leading" secondItem="Yan-r6-V5Z" secondAttribute="leading" id="OzI-eT-Ddp"/>
|
||||
<constraint firstItem="5Fg-Tr-Kiy" firstAttribute="top" secondItem="Yan-r6-V5Z" secondAttribute="bottom" constant="2" id="Q7d-lf-YOu"/>
|
||||
<constraint firstItem="Ryd-OQ-Nok" firstAttribute="trailing" secondItem="Yan-r6-V5Z" secondAttribute="trailing" constant="12" id="byj-KU-yj5"/>
|
||||
<constraint firstItem="1d5-Y3-Op5" firstAttribute="top" secondItem="Ryd-OQ-Nok" secondAttribute="top" id="coe-an-hym"/>
|
||||
<constraint firstItem="Yan-r6-V5Z" firstAttribute="leading" secondItem="Uqs-BQ-GEC" secondAttribute="trailing" constant="8" symbolic="YES" id="d8l-bR-cyG"/>
|
||||
<constraint firstItem="Uqs-BQ-GEC" firstAttribute="top" secondItem="Ryd-OQ-Nok" secondAttribute="top" constant="8" id="eeC-L4-HDW"/>
|
||||
</constraints>
|
||||
</collectionViewCellContentView>
|
||||
<size key="customSize" width="386" height="52"/>
|
||||
<connections>
|
||||
<outlet property="articleByLine" destination="o3c-FZ-gKE" id="Rvb-MC-pbA"/>
|
||||
<outlet property="articleContent" destination="Yan-r6-V5Z" id="FMW-ye-boq"/>
|
||||
<outlet property="articleDate" destination="aGY-Xq-5YU" id="pQl-d6-8jK"/>
|
||||
<outlet property="indicatorView" destination="Uqs-BQ-GEC" id="xXE-x6-hBa"/>
|
||||
<outlet property="metaDataStackView" destination="5Fg-Tr-Kiy" id="F9V-La-EMd"/>
|
||||
<outlet property="topSeparator" destination="1d5-Y3-Op5" id="v8Z-Z8-IBl"/>
|
||||
</connections>
|
||||
</collectionViewCell>
|
||||
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="MainTimelineCellStandard" id="Mxu-98-EdP" customClass="MainTimelineCollectionViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="8" y="62" width="386" height="52"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<collectionViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="LRz-kL-lsv">
|
||||
<rect key="frame" x="0.0" y="0.0" width="386" height="52"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fNi-gn-bjx">
|
||||
<rect key="frame" x="36" y="0.0" width="338" height="1"/>
|
||||
<color key="backgroundColor" systemColor="separatorColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="yEg-TP-34y"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="EQl-0T-Ks7" customClass="IconView" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="12" y="8" width="16" height="16"/>
|
||||
<color key="backgroundColor" systemColor="secondarySystemBackgroundColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="16" id="TEi-aG-mME"/>
|
||||
<constraint firstAttribute="width" constant="16" id="YG0-MV-XMc"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Article Content" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="h4j-SE-f60">
|
||||
<rect key="frame" x="36" y="5.9999999999999982" width="338" height="20.333333333333329"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" alignment="center" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="1Y6-rg-S6P">
|
||||
<rect key="frame" x="36" y="28.333333333333332" width="338" height="14.333333333333332"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="authorByLine" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NSi-68-toP">
|
||||
<rect key="frame" x="0.0" y="0.0" width="168" height="14.333333333333334"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
|
||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="articleDate" textAlignment="right" lineBreakMode="wordWrap" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pk2-pA-n2G">
|
||||
<rect key="frame" x="170" y="0.0" width="168" height="14.333333333333334"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
|
||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</stackView>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="8mm-gH-cye"/>
|
||||
<constraints>
|
||||
<constraint firstItem="8mm-gH-cye" firstAttribute="bottom" secondItem="1Y6-rg-S6P" secondAttribute="bottom" constant="9.3333333333333357" id="CbT-jF-kwj"/>
|
||||
<constraint firstItem="fNi-gn-bjx" firstAttribute="trailing" secondItem="h4j-SE-f60" secondAttribute="trailing" id="GYt-5f-9Tj"/>
|
||||
<constraint firstItem="EQl-0T-Ks7" firstAttribute="top" secondItem="8mm-gH-cye" secondAttribute="top" constant="8" id="Mnq-AL-J9x"/>
|
||||
<constraint firstItem="h4j-SE-f60" firstAttribute="leading" secondItem="EQl-0T-Ks7" secondAttribute="trailing" constant="8" symbolic="YES" id="NMx-Pv-922"/>
|
||||
<constraint firstItem="EQl-0T-Ks7" firstAttribute="leading" secondItem="8mm-gH-cye" secondAttribute="leading" constant="12" id="PQg-ee-7WB"/>
|
||||
<constraint firstItem="1Y6-rg-S6P" firstAttribute="leading" secondItem="h4j-SE-f60" secondAttribute="leading" id="WL8-xd-3AC"/>
|
||||
<constraint firstItem="h4j-SE-f60" firstAttribute="top" secondItem="8mm-gH-cye" secondAttribute="top" constant="6" id="iE6-Mt-kvv"/>
|
||||
<constraint firstItem="8mm-gH-cye" firstAttribute="trailing" secondItem="h4j-SE-f60" secondAttribute="trailing" constant="12" id="jwI-60-Njt"/>
|
||||
<constraint firstItem="8mm-gH-cye" firstAttribute="trailing" secondItem="1Y6-rg-S6P" secondAttribute="trailing" constant="12" id="ruj-nK-2zO"/>
|
||||
<constraint firstItem="fNi-gn-bjx" firstAttribute="leading" secondItem="h4j-SE-f60" secondAttribute="leading" id="sDV-bM-z9i"/>
|
||||
<constraint firstItem="fNi-gn-bjx" firstAttribute="top" secondItem="8mm-gH-cye" secondAttribute="top" id="uQJ-wt-uU7"/>
|
||||
<constraint firstItem="1Y6-rg-S6P" firstAttribute="top" secondItem="h4j-SE-f60" secondAttribute="bottom" constant="2" id="x30-0U-959"/>
|
||||
</constraints>
|
||||
</collectionViewCellContentView>
|
||||
<size key="customSize" width="386" height="52"/>
|
||||
<connections>
|
||||
<outlet property="articleByLine" destination="NSi-68-toP" id="wcT-rj-i7U"/>
|
||||
<outlet property="articleContent" destination="h4j-SE-f60" id="0Ox-RV-6J6"/>
|
||||
<outlet property="articleDate" destination="pk2-pA-n2G" id="E8V-DX-RgA"/>
|
||||
<outlet property="indicatorView" destination="EQl-0T-Ks7" id="dMp-de-q0V"/>
|
||||
<outlet property="metaDataStackView" destination="1Y6-rg-S6P" id="MP2-eW-Mso"/>
|
||||
<outlet property="topSeparator" destination="fNi-gn-bjx" id="c4d-s7-Krb"/>
|
||||
</connections>
|
||||
</collectionViewCell>
|
||||
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="MainTimelineCellIconIndexZero" id="UfC-jX-8iV" customClass="MainTimelineCollectionViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="8" y="124" width="386" height="55"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<collectionViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="Clj-Wp-0Wl">
|
||||
<rect key="frame" x="0.0" y="0.0" width="386" height="55"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="JuI-qj-gCR" customClass="IconView" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="12" y="8" width="16" height="16"/>
|
||||
<color key="backgroundColor" systemColor="secondarySystemFillColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="16" id="XZF-D0-fnX"/>
|
||||
<constraint firstAttribute="height" constant="16" id="YiR-7D-7e0"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Yb4-je-eHg" customClass="IconView" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="36" y="8" width="36" height="36"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="36" id="LkX-Xj-fZf"/>
|
||||
<constraint firstAttribute="height" constant="36" id="Yya-dk-F7x"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Article Content" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1rh-TG-4t8">
|
||||
<rect key="frame" x="80" y="5.9999999999999982" width="294" height="20.333333333333329"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" alignment="center" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="lgo-IC-NEC">
|
||||
<rect key="frame" x="80" y="28.999999999999996" width="294" height="14.333333333333332"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="authorByLine" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kYC-07-iWu">
|
||||
<rect key="frame" x="0.0" y="0.0" width="146" height="14.333333333333334"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
|
||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="articleDate" textAlignment="right" lineBreakMode="wordWrap" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1tb-Fr-7LL">
|
||||
<rect key="frame" x="148" y="0.0" width="146" height="14.333333333333334"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
|
||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</stackView>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nj2-sM-Flq">
|
||||
<rect key="frame" x="12" y="0.0" width="362" height="1"/>
|
||||
<color key="backgroundColor" systemColor="separatorColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="T0c-BM-pV6"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="JIt-Zk-R1i"/>
|
||||
<constraints>
|
||||
<constraint firstItem="1rh-TG-4t8" firstAttribute="top" secondItem="JIt-Zk-R1i" secondAttribute="top" constant="6" id="5Gx-ae-0qm"/>
|
||||
<constraint firstItem="JuI-qj-gCR" firstAttribute="top" secondItem="JIt-Zk-R1i" secondAttribute="top" constant="8" id="8Oi-mc-g2A"/>
|
||||
<constraint firstItem="nj2-sM-Flq" firstAttribute="top" secondItem="JIt-Zk-R1i" secondAttribute="top" id="9N0-5g-1hy"/>
|
||||
<constraint firstItem="1rh-TG-4t8" firstAttribute="leading" secondItem="Yb4-je-eHg" secondAttribute="trailing" constant="8" symbolic="YES" id="CQ6-D9-AuG"/>
|
||||
<constraint firstItem="nj2-sM-Flq" firstAttribute="trailing" secondItem="1rh-TG-4t8" secondAttribute="trailing" id="MsQ-5T-oKC"/>
|
||||
<constraint firstItem="JIt-Zk-R1i" firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="lgo-IC-NEC" secondAttribute="bottom" constant="9.3300000000000001" id="Rd8-1j-JOC"/>
|
||||
<constraint firstItem="lgo-IC-NEC" firstAttribute="top" secondItem="1rh-TG-4t8" secondAttribute="bottom" constant="2.6666666666666714" id="Rmc-dT-5hQ"/>
|
||||
<constraint firstItem="JIt-Zk-R1i" firstAttribute="trailing" secondItem="1rh-TG-4t8" secondAttribute="trailing" constant="12" id="UWb-XW-1Cp"/>
|
||||
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="Yb4-je-eHg" secondAttribute="bottom" constant="7" id="X77-GP-48D"/>
|
||||
<constraint firstItem="JIt-Zk-R1i" firstAttribute="trailing" secondItem="lgo-IC-NEC" secondAttribute="trailing" constant="12" id="cJL-XZ-oDw"/>
|
||||
<constraint firstItem="nj2-sM-Flq" firstAttribute="leading" secondItem="JuI-qj-gCR" secondAttribute="leading" id="ezR-ZU-b5P"/>
|
||||
<constraint firstItem="lgo-IC-NEC" firstAttribute="leading" secondItem="1rh-TG-4t8" secondAttribute="leading" id="f5a-yo-icp"/>
|
||||
<constraint firstItem="JuI-qj-gCR" firstAttribute="leading" secondItem="JIt-Zk-R1i" secondAttribute="leading" constant="12" id="mvP-rc-owQ"/>
|
||||
<constraint firstItem="Yb4-je-eHg" firstAttribute="leading" secondItem="JuI-qj-gCR" secondAttribute="trailing" constant="8" id="noZ-sK-fH0"/>
|
||||
<constraint firstItem="Yb4-je-eHg" firstAttribute="top" secondItem="JIt-Zk-R1i" secondAttribute="top" constant="8" id="tX5-l6-fhV"/>
|
||||
</constraints>
|
||||
</collectionViewCellContentView>
|
||||
<size key="customSize" width="386" height="55"/>
|
||||
<connections>
|
||||
<outlet property="articleByLine" destination="kYC-07-iWu" id="6fC-Fq-9hC"/>
|
||||
<outlet property="articleContent" destination="1rh-TG-4t8" id="MnB-DE-n6A"/>
|
||||
<outlet property="articleDate" destination="1tb-Fr-7LL" id="Owf-XG-57A"/>
|
||||
<outlet property="feedIcon" destination="Yb4-je-eHg" id="egJ-UF-rp9"/>
|
||||
<outlet property="indicatorView" destination="JuI-qj-gCR" id="w5B-XF-SaE"/>
|
||||
<outlet property="metaDataStackView" destination="lgo-IC-NEC" id="WaH-c6-Bhi"/>
|
||||
<outlet property="topSeparator" destination="nj2-sM-Flq" id="ygu-22-n7S"/>
|
||||
</connections>
|
||||
</collectionViewCell>
|
||||
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="MainTimelineCellIcon" id="Vam-6u-7Ng" userLabel="MainTimelineCellIcon" customClass="MainTimelineCollectionViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="8" y="189" width="386" height="55"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<collectionViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="N8Y-jf-wcX">
|
||||
<rect key="frame" x="0.0" y="0.0" width="386" height="55"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="yrT-cr-PV7" customClass="IconView" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="12" y="8" width="16" height="16"/>
|
||||
<color key="backgroundColor" systemColor="secondarySystemFillColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="16" id="CaG-Xs-Wve"/>
|
||||
<constraint firstAttribute="height" constant="16" id="TbR-JV-2D1"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="oR6-Is-fGr" customClass="IconView" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="36" y="8" width="36" height="36"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="36" id="1OK-10-Fq1"/>
|
||||
<constraint firstAttribute="width" constant="36" id="haU-2J-z8p"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Article Content" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="O03-6u-AcE">
|
||||
<rect key="frame" x="80" y="5.9999999999999982" width="294" height="20.333333333333329"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" alignment="center" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="Mzm-P5-SeC">
|
||||
<rect key="frame" x="80" y="28.999999999999996" width="294" height="14.333333333333332"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="authorByLine" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9nR-Dd-ZuE">
|
||||
<rect key="frame" x="0.0" y="0.0" width="146" height="14.333333333333334"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
|
||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="articleDate" textAlignment="right" lineBreakMode="wordWrap" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pLf-h1-h8G">
|
||||
<rect key="frame" x="148" y="0.0" width="146" height="14.333333333333334"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
|
||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</stackView>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fP1-Cp-b0P">
|
||||
<rect key="frame" x="80" y="0.0" width="294" height="1"/>
|
||||
<color key="backgroundColor" systemColor="separatorColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="vZ0-vW-48g"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="YvV-qC-yEu"/>
|
||||
<constraints>
|
||||
<constraint firstItem="O03-6u-AcE" firstAttribute="top" secondItem="YvV-qC-yEu" secondAttribute="top" constant="6" id="0cO-u7-nn1"/>
|
||||
<constraint firstItem="YvV-qC-yEu" firstAttribute="trailing" secondItem="Mzm-P5-SeC" secondAttribute="trailing" constant="12" id="2Ya-vc-ivc"/>
|
||||
<constraint firstItem="yrT-cr-PV7" firstAttribute="top" secondItem="YvV-qC-yEu" secondAttribute="top" constant="8" id="7yA-25-oTM"/>
|
||||
<constraint firstItem="O03-6u-AcE" firstAttribute="leading" secondItem="oR6-Is-fGr" secondAttribute="trailing" constant="8" symbolic="YES" id="HVB-Nz-iYq"/>
|
||||
<constraint firstItem="fP1-Cp-b0P" firstAttribute="top" secondItem="YvV-qC-yEu" secondAttribute="top" id="Hzn-T2-WQD"/>
|
||||
<constraint firstItem="Mzm-P5-SeC" firstAttribute="leading" secondItem="O03-6u-AcE" secondAttribute="leading" id="OCH-Jk-pap"/>
|
||||
<constraint firstItem="yrT-cr-PV7" firstAttribute="leading" secondItem="YvV-qC-yEu" secondAttribute="leading" constant="12" id="Rzv-Tr-NTy"/>
|
||||
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="oR6-Is-fGr" secondAttribute="bottom" constant="7" id="VRp-NS-jjU"/>
|
||||
<constraint firstItem="YvV-qC-yEu" firstAttribute="trailing" secondItem="O03-6u-AcE" secondAttribute="trailing" constant="12" id="Vxz-ky-0mj"/>
|
||||
<constraint firstItem="oR6-Is-fGr" firstAttribute="leading" secondItem="yrT-cr-PV7" secondAttribute="trailing" constant="8" id="bmo-Xv-fES"/>
|
||||
<constraint firstItem="oR6-Is-fGr" firstAttribute="top" secondItem="YvV-qC-yEu" secondAttribute="top" constant="8" id="fHy-Tj-AXE"/>
|
||||
<constraint firstItem="Mzm-P5-SeC" firstAttribute="top" secondItem="O03-6u-AcE" secondAttribute="bottom" constant="2.6666666666666714" id="l96-Py-rYK"/>
|
||||
<constraint firstItem="fP1-Cp-b0P" firstAttribute="trailing" secondItem="O03-6u-AcE" secondAttribute="trailing" id="lta-Kh-ywc"/>
|
||||
<constraint firstItem="YvV-qC-yEu" firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="Mzm-P5-SeC" secondAttribute="bottom" constant="9.3300000000000001" id="mo3-dA-9un"/>
|
||||
<constraint firstItem="fP1-Cp-b0P" firstAttribute="leading" secondItem="O03-6u-AcE" secondAttribute="leading" id="rRV-94-BmU"/>
|
||||
</constraints>
|
||||
</collectionViewCellContentView>
|
||||
<size key="customSize" width="386" height="55"/>
|
||||
<connections>
|
||||
<outlet property="articleByLine" destination="9nR-Dd-ZuE" id="Nob-Rc-nMm"/>
|
||||
<outlet property="articleContent" destination="O03-6u-AcE" id="Ogx-Ic-fqN"/>
|
||||
<outlet property="articleDate" destination="pLf-h1-h8G" id="cqd-Be-C2z"/>
|
||||
<outlet property="feedIcon" destination="oR6-Is-fGr" id="QMn-kI-uNH"/>
|
||||
<outlet property="indicatorView" destination="yrT-cr-PV7" id="lxe-Mx-blu"/>
|
||||
<outlet property="metaDataStackView" destination="Mzm-P5-SeC" id="wZq-Ag-BU0"/>
|
||||
<outlet property="topSeparator" destination="fP1-Cp-b0P" id="jYs-gw-mm9"/>
|
||||
</connections>
|
||||
</collectionViewCell>
|
||||
</cells>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="QJM-al-rDe" id="SFB-v8-UuF"/>
|
||||
|
||||
@@ -0,0 +1,235 @@
|
||||
//
|
||||
// MainTimelineCell.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Brent Simmons on 6/22/26.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import RSCore
|
||||
import Images
|
||||
|
||||
/// Manual-layout timeline cell modeled on the Mac timeline
|
||||
/// and the pre-7.0 iOS table view cell.
|
||||
final class MainTimelineCell: UICollectionViewCell {
|
||||
|
||||
static let reuseIdentifier = "MainTimelineCell"
|
||||
|
||||
var isPreview = false
|
||||
|
||||
private let titleView = MainTimelineCell.multiLineLabel()
|
||||
private let summaryView = MainTimelineCell.multiLineLabel()
|
||||
private let dateView = MainTimelineCell.singleLineLabel()
|
||||
private let feedNameView = MainTimelineCell.singleLineLabel()
|
||||
private lazy var iconView = IconView()
|
||||
private lazy var indicatorView = IconView()
|
||||
private let topSeparator = UIView()
|
||||
|
||||
var cellData: MainTimelineCellData! {
|
||||
didSet {
|
||||
updateSubviews()
|
||||
}
|
||||
}
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
commonInit()
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
super.init(coder: coder)
|
||||
commonInit()
|
||||
}
|
||||
|
||||
override func prepareForReuse() {
|
||||
super.prepareForReuse()
|
||||
indicatorView.isHidden = true
|
||||
}
|
||||
|
||||
override func preferredLayoutAttributesFitting(_ layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes {
|
||||
let layout = updatedLayout(width: layoutAttributes.frame.width)
|
||||
layoutAttributes.frame.size.height = layout.height
|
||||
return layoutAttributes
|
||||
}
|
||||
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
|
||||
let layout = updatedLayout(width: contentView.bounds.width)
|
||||
|
||||
setFrame(for: titleView, rect: layout.titleRect)
|
||||
setFrame(for: summaryView, rect: layout.summaryRect)
|
||||
feedNameView.setFrameIfNotEqual(layout.feedNameRect)
|
||||
dateView.setFrameIfNotEqual(layout.dateRect)
|
||||
iconView.setFrameIfNotEqual(layout.iconImageRect)
|
||||
indicatorView.setFrameIfNotEqual(cellData.starred ? layout.starRect : layout.unreadIndicatorRect)
|
||||
topSeparator.frame = CGRect(x: layout.separatorRect.minX, y: 0, width: layout.separatorRect.width, height: 1.0 / traitCollection.displayScale)
|
||||
}
|
||||
|
||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||
super.updateConfiguration(using: state)
|
||||
|
||||
var backgroundConfig: UIBackgroundConfiguration
|
||||
if #available(iOS 18, *) {
|
||||
backgroundConfig = UIBackgroundConfiguration.listCell().updated(for: state)
|
||||
} else {
|
||||
backgroundConfig = UIBackgroundConfiguration.listGroupedCell().updated(for: state)
|
||||
}
|
||||
if #available(iOS 26, *) {
|
||||
backgroundConfig.cornerRadius = 20
|
||||
backgroundConfig.edgesAddingLayoutMarginsToBackgroundInsets = [.leading, .trailing]
|
||||
if UIDevice.current.userInterfaceIdiom == .pad {
|
||||
backgroundConfig.backgroundInsets = NSDirectionalEdgeInsets(top: 0, leading: -8, bottom: 0, trailing: -8)
|
||||
} else if isPreview {
|
||||
backgroundConfig.backgroundInsets = NSDirectionalEdgeInsets(top: 0, leading: -16, bottom: 0, trailing: -16)
|
||||
} else {
|
||||
backgroundConfig.backgroundInsets = NSDirectionalEdgeInsets(top: 0, leading: -12, bottom: 0, trailing: -12)
|
||||
}
|
||||
} else {
|
||||
backgroundConfig.cornerRadius = 0
|
||||
}
|
||||
|
||||
if state.isSelected {
|
||||
backgroundConfig.backgroundColor = Assets.Colors.primaryAccent
|
||||
} else if state.isSwiped {
|
||||
backgroundConfig.backgroundColor = .secondarySystemFill
|
||||
} else {
|
||||
backgroundConfig.backgroundColor = .clear
|
||||
}
|
||||
|
||||
let isActive = state.isSwiped || state.isSelected
|
||||
|
||||
if isPreview {
|
||||
backgroundConfig.backgroundColor = traitCollection.userInterfaceStyle == .dark ? .secondarySystemBackground : .white
|
||||
}
|
||||
backgroundConfiguration = backgroundConfig
|
||||
|
||||
topSeparator.alpha = (isActive || isPreview) ? 0.0 : 1.0
|
||||
|
||||
updateColors(active: isActive)
|
||||
updateIndicatorView(active: isActive)
|
||||
}
|
||||
|
||||
func setIconImage(_ image: IconImage) {
|
||||
iconView.iconImage = image
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private extension MainTimelineCell {
|
||||
|
||||
static func singleLineLabel() -> UILabel {
|
||||
let label = NonIntrinsicLabel()
|
||||
label.lineBreakMode = .byTruncatingTail
|
||||
label.allowsDefaultTighteningForTruncation = false
|
||||
label.adjustsFontForContentSizeCategory = true
|
||||
return label
|
||||
}
|
||||
|
||||
static func multiLineLabel() -> UILabel {
|
||||
let label = NonIntrinsicLabel()
|
||||
label.numberOfLines = 0
|
||||
label.lineBreakMode = .byTruncatingTail
|
||||
label.allowsDefaultTighteningForTruncation = false
|
||||
label.adjustsFontForContentSizeCategory = true
|
||||
return label
|
||||
}
|
||||
|
||||
func commonInit() {
|
||||
isAccessibilityElement = true
|
||||
topSeparator.backgroundColor = .separator.withAlphaComponent(0.1)
|
||||
for view in [titleView, summaryView, dateView, feedNameView, iconView, indicatorView, topSeparator] {
|
||||
contentView.addSubview(view)
|
||||
view.isAccessibilityElement = false
|
||||
}
|
||||
indicatorView.isHidden = true
|
||||
}
|
||||
|
||||
func updatedLayout(width: CGFloat) -> MainTimelineCellLayout {
|
||||
guard cellData != nil else {
|
||||
return MainTimelineDefaultCellLayout(width: width, insets: .zero, cellData: MainTimelineCellData())
|
||||
}
|
||||
if traitCollection.preferredContentSizeCategory.isAccessibilityCategory {
|
||||
return MainTimelineAccessibilityCellLayout(width: width, insets: .zero, cellData: cellData)
|
||||
}
|
||||
return MainTimelineDefaultCellLayout(width: width, insets: .zero, cellData: cellData)
|
||||
}
|
||||
|
||||
func setFrame(for label: UILabel, rect: CGRect) {
|
||||
if Int(floor(rect.height)) == 0 || Int(floor(rect.width)) == 0 {
|
||||
label.isHidden = true
|
||||
} else {
|
||||
label.isHidden = false
|
||||
label.setFrameIfNotEqual(rect)
|
||||
}
|
||||
}
|
||||
|
||||
func updateSubviews() {
|
||||
titleView.font = MainTimelineDefaultCellLayout.titleFont
|
||||
titleView.attributedText = cellData.attributedTitle.applyingBaseFont(MainTimelineDefaultCellLayout.titleFont)
|
||||
|
||||
summaryView.font = MainTimelineDefaultCellLayout.summaryFont
|
||||
summaryView.text = cellData.summary
|
||||
|
||||
dateView.font = MainTimelineDefaultCellLayout.dateFont
|
||||
dateView.text = cellData.dateString
|
||||
|
||||
switch cellData.showFeedName {
|
||||
case .feed:
|
||||
feedNameView.font = MainTimelineDefaultCellLayout.feedNameFont
|
||||
feedNameView.text = cellData.feedName
|
||||
feedNameView.isHidden = false
|
||||
case .byline:
|
||||
feedNameView.font = MainTimelineDefaultCellLayout.feedNameFont
|
||||
feedNameView.text = cellData.byline
|
||||
feedNameView.isHidden = false
|
||||
case .none:
|
||||
feedNameView.isHidden = true
|
||||
}
|
||||
|
||||
if cellData.showIcon, let iconImage = cellData.iconImage {
|
||||
iconView.iconImage = iconImage
|
||||
iconView.isHidden = false
|
||||
} else {
|
||||
iconView.iconImage = nil
|
||||
iconView.isHidden = true
|
||||
}
|
||||
|
||||
updateColors(active: configurationState.isSelected)
|
||||
updateIndicatorView(active: configurationState.isSelected)
|
||||
updateAccessibilityLabel()
|
||||
setNeedsLayout()
|
||||
}
|
||||
|
||||
func updateColors(active: Bool) {
|
||||
titleView.textColor = active ? .white : .label
|
||||
summaryView.textColor = active ? .white : (cellData.title.isEmpty ? .label : .secondaryLabel)
|
||||
dateView.textColor = active ? .white : .secondaryLabel
|
||||
feedNameView.textColor = active ? .white : .secondaryLabel
|
||||
}
|
||||
|
||||
func updateIndicatorView(active: Bool) {
|
||||
guard cellData != nil else {
|
||||
indicatorView.isHidden = true
|
||||
return
|
||||
}
|
||||
if cellData.starred {
|
||||
indicatorView.iconImage = Assets.Images.starredFeed
|
||||
indicatorView.tintColor = active ? .white : Assets.Colors.star
|
||||
indicatorView.isHidden = false
|
||||
} else if !cellData.read {
|
||||
indicatorView.iconImage = Assets.Images.unreadCellIndicator
|
||||
indicatorView.tintColor = active ? .white : Assets.Colors.secondaryAccent
|
||||
indicatorView.isHidden = false
|
||||
} else {
|
||||
indicatorView.isHidden = true
|
||||
}
|
||||
}
|
||||
|
||||
func updateAccessibilityLabel() {
|
||||
let starredStatus = cellData.starred ? "\(NSLocalizedString("Starred", comment: "Starred")), " : ""
|
||||
let unreadStatus = cellData.read ? "" : "\(NSLocalizedString("Unread", comment: "Unread")), "
|
||||
accessibilityLabel = starredStatus + unreadStatus + "\(cellData.feedName), \(cellData.title), \(cellData.summary), \(cellData.dateString)"
|
||||
}
|
||||
}
|
||||
File renamed without changes.
@@ -0,0 +1,251 @@
|
||||
//
|
||||
// MainTimelineCellLayout.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Maurice Parker on 4/29/19.
|
||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import RSCore
|
||||
import Images
|
||||
|
||||
@MainActor protocol MainTimelineCellLayout {
|
||||
var height: CGFloat { get }
|
||||
var unreadIndicatorRect: CGRect { get }
|
||||
var starRect: CGRect { get }
|
||||
var iconImageRect: CGRect { get }
|
||||
var titleRect: CGRect { get }
|
||||
var summaryRect: CGRect { get }
|
||||
var feedNameRect: CGRect { get }
|
||||
var dateRect: CGRect { get }
|
||||
var separatorRect: CGRect { get }
|
||||
}
|
||||
|
||||
extension MainTimelineCellLayout {
|
||||
|
||||
static func rectForUnreadIndicator(_ point: CGPoint) -> CGRect {
|
||||
var r = CGRect.zero
|
||||
r.size = CGSize(width: MainTimelineDefaultCellLayout.unreadCircleDimension, height: MainTimelineDefaultCellLayout.unreadCircleDimension)
|
||||
r.origin.x = point.x
|
||||
r.origin.y = point.y + 5
|
||||
return r
|
||||
}
|
||||
|
||||
static func rectForStar(_ point: CGPoint) -> CGRect {
|
||||
var r = CGRect.zero
|
||||
r.size.width = MainTimelineDefaultCellLayout.starDimension
|
||||
r.size.height = MainTimelineDefaultCellLayout.starDimension
|
||||
r.origin.x = floor(point.x - ((MainTimelineDefaultCellLayout.starDimension - MainTimelineDefaultCellLayout.unreadCircleDimension) / 2.0))
|
||||
r.origin.y = point.y + 3
|
||||
return r
|
||||
}
|
||||
|
||||
static func rectForIconView(_ point: CGPoint, iconSize: IconSize) -> CGRect {
|
||||
var r = CGRect.zero
|
||||
r.size = iconSize.size
|
||||
r.origin.x = point.x
|
||||
r.origin.y = point.y + 4
|
||||
return r
|
||||
}
|
||||
|
||||
static func rectForTitle(_ cellData: MainTimelineCellData, _ point: CGPoint, _ textAreaWidth: CGFloat) -> (CGRect, Int) {
|
||||
var r = CGRect.zero
|
||||
if cellData.title.isEmpty {
|
||||
return (r, 0)
|
||||
}
|
||||
r.origin = point
|
||||
let sizeInfo = MultilineUILabelSizer.size(for: cellData.title, font: MainTimelineDefaultCellLayout.titleFont, numberOfLines: cellData.numberOfLines, width: Int(textAreaWidth))
|
||||
r.size.width = textAreaWidth
|
||||
r.size.height = sizeInfo.size.height
|
||||
if sizeInfo.numberOfLinesUsed < 1 {
|
||||
r.size.height = 0
|
||||
}
|
||||
return (r, sizeInfo.numberOfLinesUsed)
|
||||
}
|
||||
|
||||
static func rectForSummary(_ cellData: MainTimelineCellData, _ point: CGPoint, _ textAreaWidth: CGFloat, _ linesUsed: Int) -> CGRect {
|
||||
let linesLeft = cellData.numberOfLines - linesUsed
|
||||
var r = CGRect.zero
|
||||
if cellData.summary.isEmpty || linesLeft < 1 {
|
||||
return r
|
||||
}
|
||||
r.origin = point
|
||||
let sizeInfo = MultilineUILabelSizer.size(for: cellData.summary, font: MainTimelineDefaultCellLayout.summaryFont, numberOfLines: linesLeft, width: Int(textAreaWidth))
|
||||
r.size.width = textAreaWidth
|
||||
r.size.height = sizeInfo.size.height
|
||||
if sizeInfo.numberOfLinesUsed < 1 {
|
||||
r.size.height = 0
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
static func rectForFeedName(_ cellData: MainTimelineCellData, _ point: CGPoint, _ textAreaWidth: CGFloat) -> CGRect {
|
||||
var r = CGRect.zero
|
||||
r.origin = point
|
||||
let feedName = cellData.showFeedName == .feed ? cellData.feedName : cellData.byline
|
||||
let size = SingleLineUILabelSizer.size(for: feedName, font: MainTimelineDefaultCellLayout.feedNameFont)
|
||||
r.size = size
|
||||
if r.size.width > textAreaWidth {
|
||||
r.size.width = textAreaWidth
|
||||
}
|
||||
return r
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Default
|
||||
|
||||
struct MainTimelineDefaultCellLayout: MainTimelineCellLayout {
|
||||
|
||||
static let cellPadding = UIEdgeInsets(top: 12, left: 8, bottom: 12, right: 20)
|
||||
|
||||
static let unreadCircleMarginLeft = CGFloat(0)
|
||||
static let unreadCircleDimension = CGFloat(12)
|
||||
static let unreadCircleMarginRight = CGFloat(8)
|
||||
|
||||
static let starDimension = CGFloat(16)
|
||||
|
||||
static let iconMarginRight = CGFloat(8)
|
||||
static let iconCornerRadius = CGFloat(4)
|
||||
|
||||
static var titleFont: UIFont { UIFont.preferredFont(forTextStyle: .headline) }
|
||||
static let titleBottomMargin = CGFloat(1)
|
||||
|
||||
static var feedNameFont: UIFont { UIFont.preferredFont(forTextStyle: .footnote) }
|
||||
static let feedRightMargin = CGFloat(8)
|
||||
|
||||
static var dateFont: UIFont { UIFont.preferredFont(forTextStyle: .footnote) }
|
||||
static let dateMarginBottom = CGFloat(1)
|
||||
|
||||
static var summaryFont: UIFont { UIFont.preferredFont(forTextStyle: .body) }
|
||||
|
||||
let height: CGFloat
|
||||
let unreadIndicatorRect: CGRect
|
||||
let starRect: CGRect
|
||||
let iconImageRect: CGRect
|
||||
let titleRect: CGRect
|
||||
let summaryRect: CGRect
|
||||
let feedNameRect: CGRect
|
||||
let dateRect: CGRect
|
||||
let separatorRect: CGRect
|
||||
|
||||
init(width: CGFloat, insets: UIEdgeInsets, cellData: MainTimelineCellData) {
|
||||
|
||||
var currentPoint = CGPoint.zero
|
||||
currentPoint.x = Self.cellPadding.left + insets.left + Self.unreadCircleMarginLeft
|
||||
currentPoint.y = Self.cellPadding.top
|
||||
|
||||
self.unreadIndicatorRect = Self.rectForUnreadIndicator(currentPoint)
|
||||
self.starRect = Self.rectForStar(currentPoint)
|
||||
|
||||
currentPoint.x += Self.unreadCircleDimension + Self.unreadCircleMarginRight
|
||||
|
||||
if cellData.showIcon {
|
||||
self.iconImageRect = Self.rectForIconView(currentPoint, iconSize: cellData.iconSize)
|
||||
currentPoint.x = self.iconImageRect.maxX + Self.iconMarginRight
|
||||
} else {
|
||||
self.iconImageRect = CGRect.zero
|
||||
}
|
||||
|
||||
let textAreaWidth = width - (currentPoint.x + Self.cellPadding.right + insets.right)
|
||||
self.separatorRect = CGRect(x: currentPoint.x, y: 0, width: textAreaWidth, height: 0)
|
||||
|
||||
let (titleRect, numberOfLinesForTitle) = Self.rectForTitle(cellData, currentPoint, textAreaWidth)
|
||||
self.titleRect = titleRect
|
||||
|
||||
if self.titleRect != CGRect.zero {
|
||||
currentPoint.y = self.titleRect.maxY + Self.titleBottomMargin
|
||||
}
|
||||
self.summaryRect = Self.rectForSummary(cellData, currentPoint, textAreaWidth, numberOfLinesForTitle)
|
||||
|
||||
var y = [self.titleRect, self.summaryRect].maxY()
|
||||
if y == 0 {
|
||||
y = iconImageRect.origin.y + iconImageRect.height
|
||||
let tmp = Self.rectForDate(cellData, currentPoint, textAreaWidth)
|
||||
y -= tmp.height
|
||||
}
|
||||
currentPoint.y = y
|
||||
|
||||
self.dateRect = Self.rectForDate(cellData, currentPoint, textAreaWidth)
|
||||
|
||||
let feedNameWidth = textAreaWidth - (Self.feedRightMargin + self.dateRect.size.width)
|
||||
self.feedNameRect = Self.rectForFeedName(cellData, currentPoint, feedNameWidth)
|
||||
|
||||
self.height = [self.iconImageRect, self.feedNameRect].maxY() + Self.cellPadding.bottom
|
||||
}
|
||||
|
||||
static func rectForDate(_ cellData: MainTimelineCellData, _ point: CGPoint, _ textAreaWidth: CGFloat) -> CGRect {
|
||||
var r = CGRect.zero
|
||||
let size = SingleLineUILabelSizer.size(for: cellData.dateString, font: Self.dateFont)
|
||||
r.size = size
|
||||
r.origin.x = (point.x + textAreaWidth) - size.width
|
||||
r.origin.y = point.y
|
||||
return r
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Accessibility
|
||||
|
||||
struct MainTimelineAccessibilityCellLayout: MainTimelineCellLayout {
|
||||
|
||||
let height: CGFloat
|
||||
let unreadIndicatorRect: CGRect
|
||||
let starRect: CGRect
|
||||
let iconImageRect: CGRect
|
||||
let titleRect: CGRect
|
||||
let summaryRect: CGRect
|
||||
let feedNameRect: CGRect
|
||||
let dateRect: CGRect
|
||||
let separatorRect: CGRect
|
||||
|
||||
init(width: CGFloat, insets: UIEdgeInsets, cellData: MainTimelineCellData) {
|
||||
|
||||
var currentPoint = CGPoint.zero
|
||||
currentPoint.x = MainTimelineDefaultCellLayout.cellPadding.left + insets.left + MainTimelineDefaultCellLayout.unreadCircleMarginLeft
|
||||
currentPoint.y = MainTimelineDefaultCellLayout.cellPadding.top
|
||||
|
||||
self.unreadIndicatorRect = Self.rectForUnreadIndicator(currentPoint)
|
||||
self.starRect = Self.rectForStar(currentPoint)
|
||||
|
||||
currentPoint.x += MainTimelineDefaultCellLayout.unreadCircleDimension + MainTimelineDefaultCellLayout.unreadCircleMarginRight
|
||||
|
||||
if cellData.showIcon {
|
||||
self.iconImageRect = Self.rectForIconView(currentPoint, iconSize: cellData.iconSize)
|
||||
currentPoint.y = self.iconImageRect.maxY
|
||||
} else {
|
||||
self.iconImageRect = CGRect.zero
|
||||
}
|
||||
|
||||
let textAreaWidth = width - (currentPoint.x + MainTimelineDefaultCellLayout.cellPadding.right + insets.right)
|
||||
self.separatorRect = CGRect(x: currentPoint.x, y: 0, width: textAreaWidth, height: 0)
|
||||
|
||||
let (titleRect, numberOfLinesForTitle) = Self.rectForTitle(cellData, currentPoint, textAreaWidth)
|
||||
self.titleRect = titleRect
|
||||
|
||||
if self.titleRect != CGRect.zero {
|
||||
currentPoint.y = self.titleRect.maxY + MainTimelineDefaultCellLayout.titleBottomMargin
|
||||
}
|
||||
self.summaryRect = Self.rectForSummary(cellData, currentPoint, textAreaWidth, numberOfLinesForTitle)
|
||||
|
||||
currentPoint.y = [self.titleRect, self.summaryRect].maxY()
|
||||
|
||||
if cellData.showFeedName != .none {
|
||||
self.feedNameRect = Self.rectForFeedName(cellData, currentPoint, textAreaWidth)
|
||||
currentPoint.y = self.feedNameRect.maxY
|
||||
} else {
|
||||
self.feedNameRect = CGRect.zero
|
||||
}
|
||||
|
||||
self.dateRect = Self.rectForDate(cellData, currentPoint, textAreaWidth)
|
||||
|
||||
self.height = self.dateRect.maxY + MainTimelineDefaultCellLayout.cellPadding.bottom
|
||||
}
|
||||
|
||||
static func rectForDate(_ cellData: MainTimelineCellData, _ point: CGPoint, _ textAreaWidth: CGFloat) -> CGRect {
|
||||
var r = CGRect.zero
|
||||
let size = SingleLineUILabelSizer.size(for: cellData.dateString, font: MainTimelineDefaultCellLayout.dateFont)
|
||||
r.size = size
|
||||
r.origin = point
|
||||
return r
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
//
|
||||
// MultilineUILabelSizer.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Brent Simmons on 2/19/18.
|
||||
// Copyright © 2018 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
// Get the height of a UILabel given a string, font, and width.
|
||||
// Uses a cache. Avoids actually measuring text as much as possible.
|
||||
// Main thread only.
|
||||
|
||||
typealias WidthHeightCache = [Int: Int] // width: height
|
||||
|
||||
private struct UILabelSizerSpecifier: Hashable {
|
||||
let numberOfLines: Int
|
||||
let font: UIFont
|
||||
}
|
||||
|
||||
struct TextFieldSizeInfo {
|
||||
let size: CGSize // Integral size (ceiled)
|
||||
let numberOfLinesUsed: Int // A two-line label may only use one line, for instance. This would equal 1, then.
|
||||
}
|
||||
|
||||
@MainActor final class MultilineUILabelSizer {
|
||||
|
||||
private let numberOfLines: Int
|
||||
private let font: UIFont
|
||||
private let singleLineHeightEstimate: Int
|
||||
private let doubleLineHeightEstimate: Int
|
||||
private var cache = [String: WidthHeightCache]() // Each string has a cache.
|
||||
private static var sizers = [UILabelSizerSpecifier: MultilineUILabelSizer]()
|
||||
|
||||
private init(numberOfLines: Int, font: UIFont) {
|
||||
self.numberOfLines = numberOfLines
|
||||
self.font = font
|
||||
self.singleLineHeightEstimate = MultilineUILabelSizer.calculateHeight("AqLjJ0/y", 200, font)
|
||||
self.doubleLineHeightEstimate = MultilineUILabelSizer.calculateHeight("AqLjJ0/y\nAqLjJ0/y", 200, font)
|
||||
}
|
||||
|
||||
static func size(for string: String, font: UIFont, numberOfLines: Int, width: Int) -> TextFieldSizeInfo {
|
||||
sizer(numberOfLines: numberOfLines, font: font).sizeInfo(for: string, width: width)
|
||||
}
|
||||
|
||||
static func emptyCache() {
|
||||
sizers = [UILabelSizerSpecifier: MultilineUILabelSizer]()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private extension MultilineUILabelSizer {
|
||||
|
||||
static func sizer(numberOfLines: Int, font: UIFont) -> MultilineUILabelSizer {
|
||||
let specifier = UILabelSizerSpecifier(numberOfLines: numberOfLines, font: font)
|
||||
if let cachedSizer = sizers[specifier] {
|
||||
return cachedSizer
|
||||
}
|
||||
let newSizer = MultilineUILabelSizer(numberOfLines: numberOfLines, font: font)
|
||||
sizers[specifier] = newSizer
|
||||
return newSizer
|
||||
}
|
||||
|
||||
func sizeInfo(for string: String, width: Int) -> TextFieldSizeInfo {
|
||||
let labelHeight = height(for: string, width: width)
|
||||
let numberOfLinesUsed = numberOfLines(for: labelHeight)
|
||||
let size = CGSize(width: width, height: labelHeight)
|
||||
return TextFieldSizeInfo(size: size, numberOfLinesUsed: numberOfLinesUsed)
|
||||
}
|
||||
|
||||
func height(for string: String, width: Int) -> Int {
|
||||
if cache[string] == nil {
|
||||
cache[string] = WidthHeightCache()
|
||||
}
|
||||
if let height = cache[string]![width] {
|
||||
return height
|
||||
}
|
||||
if let height = heightConsideringNeighbors(cache[string]!, width) {
|
||||
return height
|
||||
}
|
||||
|
||||
var height = MultilineUILabelSizer.calculateHeight(string, width, font)
|
||||
if numberOfLines != 0 {
|
||||
let maxHeight = singleLineHeightEstimate * numberOfLines
|
||||
if height > maxHeight {
|
||||
height = maxHeight
|
||||
}
|
||||
}
|
||||
|
||||
cache[string]![width] = height
|
||||
return height
|
||||
}
|
||||
|
||||
static func calculateHeight(_ string: String, _ width: Int, _ font: UIFont) -> Int {
|
||||
let height = string.height(withConstrainedWidth: CGFloat(width), font: font)
|
||||
return Int(ceil(height))
|
||||
}
|
||||
|
||||
func numberOfLines(for height: Int) -> Int {
|
||||
let averageHeight = CGFloat(doubleLineHeightEstimate) / 2.0
|
||||
return Int(round(CGFloat(height) / averageHeight))
|
||||
}
|
||||
|
||||
func heightIsProbablySingleLineHeight(_ height: Int) -> Bool {
|
||||
heightIsProbablyEqualToEstimate(height, singleLineHeightEstimate)
|
||||
}
|
||||
|
||||
func heightIsProbablyDoubleLineHeight(_ height: Int) -> Bool {
|
||||
heightIsProbablyEqualToEstimate(height, doubleLineHeightEstimate)
|
||||
}
|
||||
|
||||
func heightIsProbablyEqualToEstimate(_ height: Int, _ estimate: Int) -> Bool {
|
||||
let slop = 4
|
||||
let minimum = estimate - slop
|
||||
let maximum = estimate + slop
|
||||
return height >= minimum && height <= maximum
|
||||
}
|
||||
|
||||
func heightConsideringNeighbors(_ heightCache: WidthHeightCache, _ width: Int) -> Int? {
|
||||
// Given width, if the height at width - something and width + something is equal,
|
||||
// then that height must be correct for the given width.
|
||||
|
||||
var smallNeighbor = (width: 0, height: 0)
|
||||
var largeNeighbor = (width: 0, height: 0)
|
||||
|
||||
for (oneWidth, oneHeight) in heightCache {
|
||||
|
||||
if oneWidth < width && heightIsProbablySingleLineHeight(oneHeight) {
|
||||
return oneHeight
|
||||
}
|
||||
if numberOfLines == 2 && oneWidth > width && heightIsProbablyDoubleLineHeight(oneHeight) {
|
||||
return oneHeight
|
||||
}
|
||||
|
||||
if oneWidth < width && (oneWidth > smallNeighbor.width || smallNeighbor.width == 0) {
|
||||
smallNeighbor = (oneWidth, oneHeight)
|
||||
} else if oneWidth > width && (oneWidth < largeNeighbor.width || largeNeighbor.width == 0) {
|
||||
largeNeighbor = (oneWidth, oneHeight)
|
||||
}
|
||||
|
||||
if smallNeighbor.width != 0 && smallNeighbor.height == largeNeighbor.height {
|
||||
return smallNeighbor.height
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// SingleLineUILabelSizer.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Brent Simmons on 2/19/18.
|
||||
// Copyright © 2018 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
// Get the size of a UILabel configured with a specific font. Uses a cache. Main thread only.
|
||||
|
||||
@MainActor final class SingleLineUILabelSizer {
|
||||
|
||||
let font: UIFont
|
||||
private var cache = [String: CGSize]()
|
||||
|
||||
init(font: UIFont) {
|
||||
self.font = font
|
||||
}
|
||||
|
||||
func size(for text: String) -> CGSize {
|
||||
if let cachedSize = cache[text] {
|
||||
return cachedSize
|
||||
}
|
||||
let height = text.height(withConstrainedWidth: .greatestFiniteMagnitude, font: font)
|
||||
let width = text.width(withConstrainedHeight: .greatestFiniteMagnitude, font: font)
|
||||
let calculatedSize = CGSize(width: ceil(width), height: ceil(height))
|
||||
cache[text] = calculatedSize
|
||||
return calculatedSize
|
||||
}
|
||||
|
||||
private static var sizers = [UIFont: SingleLineUILabelSizer]()
|
||||
|
||||
static func sizer(for font: UIFont) -> SingleLineUILabelSizer {
|
||||
if let cachedSizer = sizers[font] {
|
||||
return cachedSizer
|
||||
}
|
||||
let newSizer = SingleLineUILabelSizer(font: font)
|
||||
sizers[font] = newSizer
|
||||
return newSizer
|
||||
}
|
||||
|
||||
static func size(for text: String, font: UIFont) -> CGSize {
|
||||
sizer(for: font).size(for: text)
|
||||
}
|
||||
|
||||
static func emptyCache() {
|
||||
sizers = [UIFont: SingleLineUILabelSizer]()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// StringSize+Extensions.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Brent Simmons on 6/22/26.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
extension String {
|
||||
|
||||
func height(withConstrainedWidth width: CGFloat, font: UIFont) -> CGFloat {
|
||||
let constraintRect = CGSize(width: width, height: .greatestFiniteMagnitude)
|
||||
let boundingBox = self.boundingRect(with: constraintRect, options: [.usesLineFragmentOrigin, .usesFontLeading], attributes: [.font: font], context: nil)
|
||||
return ceil(boundingBox.height)
|
||||
}
|
||||
|
||||
func width(withConstrainedHeight height: CGFloat, font: UIFont) -> CGFloat {
|
||||
let constraintRect = CGSize(width: .greatestFiniteMagnitude, height: height)
|
||||
let boundingBox = self.boundingRect(with: constraintRect, options: [.usesLineFragmentOrigin, .usesFontLeading], attributes: [.font: font], context: nil)
|
||||
return ceil(boundingBox.width)
|
||||
}
|
||||
}
|
||||
@@ -1,466 +0,0 @@
|
||||
//
|
||||
// MainTimelineCollectionViewCell.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Stuart Breckenridge on 24/01/2026.
|
||||
// Copyright © 2026 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Account
|
||||
import Articles
|
||||
import Images
|
||||
|
||||
@MainActor private final class ArticleContentCache: NSObject {
|
||||
|
||||
struct Key: Hashable {
|
||||
let accountID: String
|
||||
let articleID: String
|
||||
}
|
||||
|
||||
struct Entry {
|
||||
let width: CGFloat
|
||||
let numberOfLines: Int
|
||||
let contentSizeCategory: UIContentSizeCategory
|
||||
let attributedText: NSAttributedString
|
||||
let lineBreakMode: NSLineBreakMode
|
||||
let rangeOfTitle: NSRange?
|
||||
let rangeOfSummary: NSRange?
|
||||
}
|
||||
|
||||
private var storage = [Key: Entry]()
|
||||
|
||||
override init() {
|
||||
super.init()
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(articlesDidDownload(_:)), name: .AccountDidDownloadArticles, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(handleLowMemory(_:)), name: .lowMemory, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(handleAppDidGoToBackground(_:)), name: .appDidGoToBackground, object: nil)
|
||||
}
|
||||
|
||||
func entry(for key: Key) -> Entry? {
|
||||
storage[key]
|
||||
}
|
||||
|
||||
func setEntry(_ entry: Entry, for key: Key) {
|
||||
storage[key] = entry
|
||||
}
|
||||
|
||||
@objc private func articlesDidDownload(_ note: Notification) {
|
||||
guard let updatedArticles = note.userInfo?[Account.UserInfoKey.updatedArticles] as? Set<Article> else {
|
||||
return
|
||||
}
|
||||
for article in updatedArticles {
|
||||
storage.removeValue(forKey: Key(accountID: article.accountID, articleID: article.articleID))
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func handleLowMemory(_ note: Notification) {
|
||||
storage.removeAll()
|
||||
}
|
||||
|
||||
@objc private func handleAppDidGoToBackground(_ note: Notification) {
|
||||
storage.removeAll()
|
||||
}
|
||||
}
|
||||
|
||||
final class MainTimelineCollectionViewCell: UICollectionViewCell {
|
||||
|
||||
@IBOutlet var articleContent: UILabel!
|
||||
@IBOutlet var articleByLine: UILabel!
|
||||
@IBOutlet var feedIcon: IconView?
|
||||
@IBOutlet var indicatorView: IconView!
|
||||
@IBOutlet var articleDate: UILabel!
|
||||
@IBOutlet var metaDataStackView: UIStackView!
|
||||
@IBOutlet var topSeparator: UIView!
|
||||
|
||||
var cellData: MainTimelineCellData! {
|
||||
didSet {
|
||||
configure(cellData)
|
||||
}
|
||||
}
|
||||
|
||||
var isPreview: Bool = false
|
||||
|
||||
// Cached Values
|
||||
private var rangeOfTitle: NSRange?
|
||||
private var rangeOfSummary: NSRange?
|
||||
private var title: String = ""
|
||||
private var summary: String = ""
|
||||
private var appliedIconSize: CGSize?
|
||||
|
||||
private static let indicatorAnimationDuration = 0.25
|
||||
|
||||
// Paragraph Styles
|
||||
private static let baseWrappingParagraphStyle: NSParagraphStyle = {
|
||||
let style = NSMutableParagraphStyle()
|
||||
style.lineBreakMode = .byWordWrapping
|
||||
style.lineBreakStrategy = []
|
||||
style.hyphenationFactor = 1.0
|
||||
style.allowsDefaultTighteningForTruncation = true
|
||||
return style
|
||||
}()
|
||||
private static let headlineBaseParagraphStyle: NSParagraphStyle = {
|
||||
let style = (baseWrappingParagraphStyle.mutableCopy() as! NSMutableParagraphStyle)
|
||||
style.hyphenationFactor = 0.5
|
||||
return style
|
||||
}()
|
||||
private static let summaryBaseParagraphStyle: NSParagraphStyle = {
|
||||
let style = (baseWrappingParagraphStyle.mutableCopy() as! NSMutableParagraphStyle)
|
||||
return style
|
||||
}()
|
||||
|
||||
private static let contentCache = ArticleContentCache()
|
||||
|
||||
// Text Storage
|
||||
private lazy var lineCountTextStorage = NSTextStorage()
|
||||
private lazy var lineCountLayoutManager: NSLayoutManager = {
|
||||
let lm = NSLayoutManager()
|
||||
lineCountTextStorage.addLayoutManager(lm)
|
||||
return lm
|
||||
}()
|
||||
private lazy var lineCountTextContainer: NSTextContainer = {
|
||||
let tc = NSTextContainer(size: .zero)
|
||||
tc.lineFragmentPadding = 0
|
||||
lineCountLayoutManager.addTextContainer(tc)
|
||||
return tc
|
||||
}()
|
||||
|
||||
override func awakeFromNib() {
|
||||
MainActor.assumeIsolated {
|
||||
super.awakeFromNib()
|
||||
isAccessibilityElement = true
|
||||
articleContent.isAccessibilityElement = false
|
||||
articleByLine.isAccessibilityElement = false
|
||||
articleDate.isAccessibilityElement = false
|
||||
indicatorView.isAccessibilityElement = false
|
||||
feedIcon?.isAccessibilityElement = false
|
||||
indicatorView.alpha = 0.0
|
||||
topSeparator.backgroundColor = .separator.withAlphaComponent(0.1)
|
||||
feedIcon?.translatesAutoresizingMaskIntoConstraints = false
|
||||
configureStackView()
|
||||
|
||||
registerForTraitChanges([UITraitPreferredContentSizeCategory.self], target: self, action: #selector(configureStackView))
|
||||
}
|
||||
}
|
||||
|
||||
override func prepareForReuse() {
|
||||
super.prepareForReuse()
|
||||
rangeOfTitle = nil
|
||||
rangeOfSummary = nil
|
||||
title = ""
|
||||
summary = ""
|
||||
}
|
||||
|
||||
private func configure(_ cellData: MainTimelineCellData) {
|
||||
articleContent.numberOfLines = cellData.numberOfLines
|
||||
updateIndicatorView(configurationState)
|
||||
if title != cellData.title || summary != cellData.summary {
|
||||
title = cellData.title
|
||||
summary = cellData.summary
|
||||
addArticleContent(configurationState)
|
||||
}
|
||||
|
||||
if cellData.showFeedName == .feed {
|
||||
articleByLine.text = cellData.feedName
|
||||
} else if cellData.showFeedName == .byline {
|
||||
articleByLine.text = cellData.byline
|
||||
} else if cellData.showFeedName == .none {
|
||||
articleByLine.text = ""
|
||||
}
|
||||
|
||||
if feedIcon != nil {
|
||||
setIconImage(cellData.iconImage, with: cellData.iconSize)
|
||||
}
|
||||
|
||||
articleDate.text = cellData.dateString
|
||||
updateAccessibilityLabel()
|
||||
}
|
||||
|
||||
private func updateAccessibilityLabel() {
|
||||
let starredStatus = cellData.starred ? "\(NSLocalizedString("Starred", comment: "Starred")), " : ""
|
||||
let unreadStatus = cellData.read ? "" : "\(NSLocalizedString("Unread", comment: "Unread")), "
|
||||
let label = starredStatus + unreadStatus + "\(cellData.feedName), \(cellData.title), \(cellData.summary), \(cellData.dateString)"
|
||||
accessibilityLabel = label
|
||||
}
|
||||
|
||||
private func updateIndicatorView(_ state: UICellConfigurationState) {
|
||||
if cellData.starred {
|
||||
if indicatorView.alpha == 0.0 {
|
||||
indicatorView.alpha = 1.0
|
||||
}
|
||||
UIView.animate(withDuration: Self.indicatorAnimationDuration) {
|
||||
self.indicatorView.iconImage = Assets.Images.starredFeed
|
||||
self.indicatorView.tintColor = (state.isSelected && !state.isSwiped) ? .white : Assets.Colors.star
|
||||
}
|
||||
return
|
||||
} else if cellData.read == false {
|
||||
if indicatorView.alpha == 0.0 {
|
||||
indicatorView.alpha = 1.0
|
||||
}
|
||||
UIView.animate(withDuration: Self.indicatorAnimationDuration) {
|
||||
self.indicatorView.iconImage = Assets.Images.unreadCellIndicator
|
||||
self.indicatorView.tintColor = (state.isSelected && !state.isSwiped) ? .white : Assets.Colors.secondaryAccent
|
||||
}
|
||||
return
|
||||
} else if indicatorView.alpha == 1.0 {
|
||||
UIView.animate(withDuration: Self.indicatorAnimationDuration) {
|
||||
self.indicatorView.alpha = 0.0
|
||||
self.indicatorView.iconImage = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func configureStackView() {
|
||||
switch traitCollection.preferredContentSizeCategory {
|
||||
case .accessibilityMedium, .accessibilityLarge, .accessibilityExtraLarge, .accessibilityExtraExtraLarge, .accessibilityExtraExtraExtraLarge:
|
||||
metaDataStackView.axis = .vertical
|
||||
metaDataStackView.alignment = .leading
|
||||
metaDataStackView.distribution = .fill
|
||||
default:
|
||||
metaDataStackView.axis = .horizontal
|
||||
metaDataStackView.alignment = .bottom
|
||||
metaDataStackView.distribution = .fillEqually
|
||||
}
|
||||
}
|
||||
|
||||
private func setIconImage(_ iconImage: IconImage?, with size: IconSize) {
|
||||
if feedIcon != nil {
|
||||
updateIconViewSizeConstraints(to: size.size)
|
||||
feedIcon!.iconImage = iconImage
|
||||
}
|
||||
}
|
||||
|
||||
private func updateIconViewSizeConstraints(to size: CGSize) {
|
||||
guard let feedIcon, appliedIconSize != size else {
|
||||
return
|
||||
}
|
||||
appliedIconSize = size
|
||||
|
||||
for constraint in feedIcon.constraints {
|
||||
constraint.isActive = false
|
||||
}
|
||||
|
||||
NSLayoutConstraint.activate([
|
||||
feedIcon.widthAnchor.constraint(equalToConstant: size.width),
|
||||
feedIcon.heightAnchor.constraint(equalToConstant: size.height)
|
||||
])
|
||||
|
||||
setNeedsLayout()
|
||||
}
|
||||
|
||||
private func addArticleContent(_ state: UICellConfigurationState) {
|
||||
let width = articleContent.bounds.width
|
||||
let numberOfLines = cellData.numberOfLines
|
||||
let contentSizeCategory = traitCollection.preferredContentSizeCategory
|
||||
|
||||
let key = ArticleContentCache.Key(accountID: cellData.accountID, articleID: cellData.articleID)
|
||||
let entry: ArticleContentCache.Entry
|
||||
if let cached = Self.contentCache.entry(for: key),
|
||||
cached.width == width, cached.numberOfLines == numberOfLines, cached.contentSizeCategory == contentSizeCategory {
|
||||
entry = cached
|
||||
} else {
|
||||
entry = buildArticleContent(width: width, numberOfLines: numberOfLines, contentSizeCategory: contentSizeCategory)
|
||||
if width > 0 {
|
||||
Self.contentCache.setEntry(entry, for: key)
|
||||
}
|
||||
}
|
||||
|
||||
articleContent.attributedText = entry.attributedText
|
||||
articleContent.lineBreakMode = entry.lineBreakMode
|
||||
rangeOfTitle = entry.rangeOfTitle
|
||||
rangeOfSummary = entry.rangeOfSummary
|
||||
}
|
||||
|
||||
private func buildArticleContent(width: CGFloat, numberOfLines: Int, contentSizeCategory: UIContentSizeCategory) -> ArticleContentCache.Entry {
|
||||
let attributedCellText = NSMutableAttributedString()
|
||||
|
||||
// 1. Prepare Title
|
||||
if cellData.title != "" {
|
||||
let titleFont = UIFont.preferredFont(forTextStyle: .headline)
|
||||
let lineHeight = titleFont.lineHeight
|
||||
|
||||
let paragraphStyle = (Self.headlineBaseParagraphStyle.mutableCopy() as! NSMutableParagraphStyle)
|
||||
paragraphStyle.minimumLineHeight = lineHeight
|
||||
paragraphStyle.maximumLineHeight = lineHeight
|
||||
|
||||
let titleAttributes: [NSAttributedString.Key: Any] = [
|
||||
.font: titleFont,
|
||||
.paragraphStyle: paragraphStyle,
|
||||
.foregroundColor: UIColor.label
|
||||
]
|
||||
|
||||
let titleAttributed = NSAttributedString(string: cellData.title, attributes: titleAttributes)
|
||||
|
||||
// 2. If the title already fills the available lines, it occupies the whole label and
|
||||
// truncates with an ellipsis if it overflows.
|
||||
let linesUsed = countLines(titleAttributed, width: width)
|
||||
if linesUsed >= numberOfLines {
|
||||
let titleRange = NSRange(location: 0, length: titleAttributed.length)
|
||||
return Self.entry(width, numberOfLines, contentSizeCategory, titleAttributed, .byTruncatingTail, titleRange, nil)
|
||||
}
|
||||
|
||||
attributedCellText.append(titleAttributed)
|
||||
}
|
||||
|
||||
let rangeOfTitle = cellData.title != "" ? NSRange(location: 0, length: attributedCellText.length) : nil
|
||||
|
||||
// 3. Prepare Summary (only reached if the title is under numberOfLines).
|
||||
var rangeOfSummary: NSRange?
|
||||
if cellData.summary != "" {
|
||||
let summaryFont = UIFont.preferredFont(forTextStyle: .body)
|
||||
let summaryLineHeight = summaryFont.lineHeight
|
||||
|
||||
let paragraphStyle = (Self.summaryBaseParagraphStyle.mutableCopy() as! NSMutableParagraphStyle)
|
||||
paragraphStyle.minimumLineHeight = summaryLineHeight
|
||||
paragraphStyle.maximumLineHeight = summaryLineHeight
|
||||
|
||||
let summaryAttributes: [NSAttributedString.Key: Any] = [
|
||||
.font: summaryFont,
|
||||
.paragraphStyle: paragraphStyle,
|
||||
.foregroundColor: cellData.title != "" ? UIColor.secondaryLabel : UIColor.label
|
||||
]
|
||||
|
||||
let prefix = cellData.title != "" ? "\n" : ""
|
||||
let summaryAttributed = NSAttributedString(string: prefix + cellData.summary, attributes: summaryAttributes)
|
||||
rangeOfSummary = NSRange(location: attributedCellText.length, length: summaryAttributed.length)
|
||||
attributedCellText.append(summaryAttributed)
|
||||
}
|
||||
|
||||
// The whole label truncates with an ellipsis only when the combined title+summary overflows;
|
||||
// when it fits, wrap so a fitting title isn't given a spurious ellipsis by the trailing summary.
|
||||
let linesUsed = countLines(attributedCellText, width: width)
|
||||
let lineBreakMode: NSLineBreakMode = linesUsed >= numberOfLines ? .byTruncatingTail : .byWordWrapping
|
||||
return Self.entry(width, numberOfLines, contentSizeCategory, attributedCellText, lineBreakMode, rangeOfTitle, rangeOfSummary)
|
||||
}
|
||||
|
||||
private static func entry(_ width: CGFloat, _ numberOfLines: Int, _ contentSizeCategory: UIContentSizeCategory, _ attributedText: NSAttributedString, _ lineBreakMode: NSLineBreakMode, _ rangeOfTitle: NSRange?, _ rangeOfSummary: NSRange?) -> ArticleContentCache.Entry {
|
||||
ArticleContentCache.Entry(width: width, numberOfLines: numberOfLines, contentSizeCategory: contentSizeCategory, attributedText: attributedText, lineBreakMode: lineBreakMode, rangeOfTitle: rangeOfTitle, rangeOfSummary: rangeOfSummary)
|
||||
}
|
||||
|
||||
func adjustArticleContentColor() {
|
||||
func applyTitleColour() {
|
||||
guard let titleRange = rangeOfTitle, titleRange.location != NSNotFound, titleRange.length > 0 else { return }
|
||||
guard let current = articleContent.attributedText else { return }
|
||||
let mutable = NSMutableAttributedString(attributedString: current)
|
||||
mutable.addAttribute(.foregroundColor, value: UIColor.label, range: titleRange)
|
||||
articleContent.attributedText = mutable
|
||||
}
|
||||
func applySummaryColour() {
|
||||
guard let summaryRange = rangeOfSummary, summaryRange.location != NSNotFound, summaryRange.length > 0 else { return }
|
||||
guard let current = articleContent.attributedText else { return }
|
||||
let mutable = NSMutableAttributedString(attributedString: current)
|
||||
mutable.addAttribute(.foregroundColor, value: cellData.title == "" ? UIColor.label : UIColor.secondaryLabel, range: summaryRange)
|
||||
articleContent.attributedText = mutable
|
||||
}
|
||||
|
||||
if configurationState.isSwiped && configurationState.isSelected {
|
||||
articleContent.textColor = .white
|
||||
articleByLine.textColor = .white
|
||||
articleDate.textColor = .white
|
||||
} else if configurationState.isSwiped && !configurationState.isSelected {
|
||||
applyTitleColour()
|
||||
applySummaryColour()
|
||||
articleByLine.textColor = .secondaryLabel
|
||||
articleDate.textColor = .secondaryLabel
|
||||
} else if !configurationState.isSwiped && configurationState.isSelected {
|
||||
articleContent.textColor = .white
|
||||
articleByLine.textColor = .white
|
||||
articleDate.textColor = .white
|
||||
} else {
|
||||
applyTitleColour()
|
||||
applySummaryColour()
|
||||
articleByLine.textColor = .secondaryLabel
|
||||
articleDate.textColor = .secondaryLabel
|
||||
}
|
||||
}
|
||||
|
||||
func countLines(_ attributed: NSAttributedString, width: CGFloat) -> Int {
|
||||
lineCountTextContainer.size = CGSize(width: width, height: .greatestFiniteMagnitude)
|
||||
lineCountTextStorage.setAttributedString(attributed)
|
||||
lineCountLayoutManager.ensureLayout(for: lineCountTextContainer)
|
||||
|
||||
var lineCount = 0
|
||||
var index = 0
|
||||
var lineRange = NSRange()
|
||||
while index < lineCountLayoutManager.numberOfGlyphs {
|
||||
lineCountLayoutManager.lineFragmentRect(forGlyphAt: index, effectiveRange: &lineRange)
|
||||
index = NSMaxRange(lineRange)
|
||||
lineCount += 1
|
||||
}
|
||||
return lineCount
|
||||
}
|
||||
|
||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||
super.updateConfiguration(using: state)
|
||||
|
||||
var backgroundConfig: UIBackgroundConfiguration
|
||||
if #available(iOS 18, *) {
|
||||
backgroundConfig = UIBackgroundConfiguration.listCell().updated(for: state)
|
||||
} else {
|
||||
backgroundConfig = UIBackgroundConfiguration.listGroupedCell().updated(for: state)
|
||||
}
|
||||
if #available(iOS 26, *) {
|
||||
backgroundConfig.cornerRadius = 20
|
||||
backgroundConfig.edgesAddingLayoutMarginsToBackgroundInsets = [.leading, .trailing]
|
||||
if UIDevice.current.userInterfaceIdiom == .pad {
|
||||
backgroundConfig.backgroundInsets = NSDirectionalEdgeInsets(top: 0, leading: -8, bottom: 0, trailing: -8)
|
||||
} else {
|
||||
if !isPreview {
|
||||
backgroundConfig.backgroundInsets = NSDirectionalEdgeInsets(top: 0, leading: -12, bottom: 0, trailing: -12)
|
||||
} else {
|
||||
backgroundConfig.backgroundInsets = NSDirectionalEdgeInsets(top: 0, leading: -16, bottom: 0, trailing: -16)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
backgroundConfig.cornerRadius = 0
|
||||
}
|
||||
|
||||
let isActive = state.isSwiped || state.isSelected
|
||||
|
||||
if state.isSwiped && state.isSelected {
|
||||
backgroundConfig.backgroundColor = Assets.Colors.primaryAccent
|
||||
} else if state.isSwiped && !state.isSelected {
|
||||
backgroundConfig.backgroundColor = .secondarySystemFill
|
||||
} else if !state.isSwiped && state.isSelected {
|
||||
backgroundConfig.backgroundColor = Assets.Colors.primaryAccent
|
||||
} else {
|
||||
backgroundConfig.backgroundColor = .clear
|
||||
}
|
||||
|
||||
// Hide this cell's separator when active, or when the cell
|
||||
// directly above is active (so no separator appears below a
|
||||
// highlighted row).
|
||||
let hideForPreviousCell = cellAboveIsActive()
|
||||
topSeparator.alpha = (isActive || hideForPreviousCell) ? 0.0 : 1.0
|
||||
adjustArticleContentColor()
|
||||
updateIndicatorView(state)
|
||||
|
||||
if isPreview {
|
||||
backgroundConfig.backgroundColor = traitCollection.userInterfaceStyle == .dark ? .secondarySystemBackground : .white
|
||||
topSeparator.alpha = 0.0
|
||||
}
|
||||
|
||||
self.backgroundConfiguration = backgroundConfig
|
||||
}
|
||||
|
||||
private func cellAboveIsActive() -> Bool {
|
||||
guard let collectionView = superview as? UICollectionView,
|
||||
let myIndexPath = collectionView.indexPath(for: self) else {
|
||||
return false
|
||||
}
|
||||
|
||||
let section = myIndexPath.section
|
||||
let item = myIndexPath.item
|
||||
guard item > 0 else {
|
||||
return false
|
||||
}
|
||||
|
||||
let previousIndexPath = IndexPath(item: item - 1, section: section)
|
||||
guard let previousCell = collectionView.cellForItem(at: previousIndexPath) else {
|
||||
return false
|
||||
}
|
||||
|
||||
let state = previousCell.configurationState
|
||||
return state.isSelected || state.isSwiped
|
||||
}
|
||||
}
|
||||
@@ -18,13 +18,6 @@ import Images
|
||||
|
||||
final class MainTimelineModernViewController: UIViewController, UndoableCommandRunner {
|
||||
|
||||
struct CellIdentifier {
|
||||
static let standard = "MainTimelineCellStandard"
|
||||
static let standardIndex0 = "MainTimelineCellIndexZero"
|
||||
static let icon = "MainTimelineCellIcon"
|
||||
static let iconIndex0 = "MainTimelineCellIconIndexZero"
|
||||
}
|
||||
|
||||
// MARK: Private Variables
|
||||
private var numberOfTextLines = 0
|
||||
private var iconSize = IconSize.medium
|
||||
@@ -841,33 +834,16 @@ private extension MainTimelineModernViewController {
|
||||
}
|
||||
|
||||
private func makeDataSource(_ collectionView: UICollectionView) -> UICollectionViewDiffableDataSource<Int, Article> {
|
||||
collectionView.register(MainTimelineCell.self, forCellWithReuseIdentifier: MainTimelineCell.reuseIdentifier)
|
||||
|
||||
let dataSource: UICollectionViewDiffableDataSource<Int, Article> =
|
||||
MainTimelineCollectionViewDataSource(collectionView: collectionView, cellProvider: { [weak self] collectionView, indexPath, article in
|
||||
guard let self else {
|
||||
return nil
|
||||
}
|
||||
let cellData = self.configure(article: article)
|
||||
if self.showIcons {
|
||||
if indexPath.row == 0 {
|
||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CellIdentifier.iconIndex0, for: indexPath) as! MainTimelineCollectionViewCell
|
||||
cell.cellData = cellData
|
||||
return cell
|
||||
} else {
|
||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CellIdentifier.icon, for: indexPath) as! MainTimelineCollectionViewCell
|
||||
cell.cellData = cellData
|
||||
return cell
|
||||
}
|
||||
} else {
|
||||
if indexPath.row == 0 {
|
||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CellIdentifier.standardIndex0, for: indexPath) as! MainTimelineCollectionViewCell
|
||||
cell.cellData = cellData
|
||||
return cell
|
||||
} else {
|
||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CellIdentifier.standard, for: indexPath) as! MainTimelineCollectionViewCell
|
||||
cell.cellData = cellData
|
||||
return cell
|
||||
}
|
||||
}
|
||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: MainTimelineCell.reuseIdentifier, for: indexPath) as! MainTimelineCell
|
||||
cell.cellData = self.configure(article: article)
|
||||
return cell
|
||||
})
|
||||
|
||||
return dataSource
|
||||
|
||||
@@ -796,161 +796,6 @@
|
||||
<outlet property="slider" destination="osf-aV-wdv" id="9mJ-Vb-q3o"/>
|
||||
</connections>
|
||||
</collectionViewCell>
|
||||
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="MainTimelineCellIcon" id="5VN-OC-hRa" userLabel="MainTimelineCellIcon" customClass="MainTimelineCollectionViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="148" width="414" height="55"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<collectionViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="RIK-ZV-VGc">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="55"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hU9-MW-Akt" customClass="IconView" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="16" y="8" width="16" height="16"/>
|
||||
<color key="backgroundColor" systemColor="secondarySystemFillColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="16" id="USX-F5-hYa"/>
|
||||
<constraint firstAttribute="height" constant="16" id="Y4Q-TK-R1p"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Jd6-0K-vfz" customClass="IconView" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="40" y="8" width="36" height="36"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="36" id="GBj-44-Vfg"/>
|
||||
<constraint firstAttribute="height" constant="36" id="tlA-k9-Sz5"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Article Content" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Abv-qJ-IDk">
|
||||
<rect key="frame" x="84" y="6" width="314" height="20.5"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" alignment="center" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="7nK-bC-Tne">
|
||||
<rect key="frame" x="84" y="29" width="314" height="14.5"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="authorByLine" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="j4f-dE-52H">
|
||||
<rect key="frame" x="0.0" y="0.0" width="156" height="14.5"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
|
||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="articleDate" textAlignment="right" lineBreakMode="wordWrap" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kGV-Iz-9Ie">
|
||||
<rect key="frame" x="158" y="0.0" width="156" height="14.5"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
|
||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</stackView>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="SL4-aj-tqQ">
|
||||
<rect key="frame" x="84" y="0.0" width="314" height="1"/>
|
||||
<color key="backgroundColor" systemColor="separatorColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="PaH-wh-nf8"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="LcC-KL-TYS"/>
|
||||
<constraints>
|
||||
<constraint firstItem="LcC-KL-TYS" firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="7nK-bC-Tne" secondAttribute="bottom" constant="9.3300000000000001" id="1LF-LM-04w"/>
|
||||
<constraint firstItem="Abv-qJ-IDk" firstAttribute="top" secondItem="LcC-KL-TYS" secondAttribute="top" constant="6" id="3Vx-fR-O0M"/>
|
||||
<constraint firstItem="hU9-MW-Akt" firstAttribute="leading" secondItem="LcC-KL-TYS" secondAttribute="leading" constant="16" id="5qr-uE-GCc"/>
|
||||
<constraint firstItem="LcC-KL-TYS" firstAttribute="trailing" secondItem="Abv-qJ-IDk" secondAttribute="trailing" constant="16" id="DsW-Ki-MBf"/>
|
||||
<constraint firstItem="7nK-bC-Tne" firstAttribute="top" secondItem="Abv-qJ-IDk" secondAttribute="bottom" constant="2.6666666666666714" id="F0z-Bh-fvb"/>
|
||||
<constraint firstItem="Abv-qJ-IDk" firstAttribute="leading" secondItem="Jd6-0K-vfz" secondAttribute="trailing" constant="8" symbolic="YES" id="MIg-cp-3eL"/>
|
||||
<constraint firstItem="7nK-bC-Tne" firstAttribute="leading" secondItem="Abv-qJ-IDk" secondAttribute="leading" id="RZT-Mi-DYb"/>
|
||||
<constraint firstItem="SL4-aj-tqQ" firstAttribute="trailing" secondItem="Abv-qJ-IDk" secondAttribute="trailing" id="VIq-Ed-7Ar"/>
|
||||
<constraint firstItem="Jd6-0K-vfz" firstAttribute="top" secondItem="LcC-KL-TYS" secondAttribute="top" constant="8" id="VmL-jq-r9t"/>
|
||||
<constraint firstItem="SL4-aj-tqQ" firstAttribute="top" secondItem="LcC-KL-TYS" secondAttribute="top" id="XTV-jn-vmE"/>
|
||||
<constraint firstItem="SL4-aj-tqQ" firstAttribute="leading" secondItem="Abv-qJ-IDk" secondAttribute="leading" id="dhg-fg-451"/>
|
||||
<constraint firstItem="Jd6-0K-vfz" firstAttribute="leading" secondItem="hU9-MW-Akt" secondAttribute="trailing" constant="8" id="ieU-rJ-kqF"/>
|
||||
<constraint firstItem="LcC-KL-TYS" firstAttribute="trailing" secondItem="7nK-bC-Tne" secondAttribute="trailing" constant="16" id="o60-za-UTi"/>
|
||||
<constraint firstItem="hU9-MW-Akt" firstAttribute="top" secondItem="LcC-KL-TYS" secondAttribute="top" constant="8" id="yYB-QM-NkJ"/>
|
||||
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="Jd6-0K-vfz" secondAttribute="bottom" constant="7" id="zoR-f8-UAM"/>
|
||||
</constraints>
|
||||
</collectionViewCellContentView>
|
||||
<size key="customSize" width="414" height="55"/>
|
||||
<connections>
|
||||
<outlet property="articleByLine" destination="j4f-dE-52H" id="XX5-qG-iJO"/>
|
||||
<outlet property="articleContent" destination="Abv-qJ-IDk" id="XuU-6i-Rpb"/>
|
||||
<outlet property="articleDate" destination="kGV-Iz-9Ie" id="iZC-A2-yDH"/>
|
||||
<outlet property="feedIcon" destination="Jd6-0K-vfz" id="4lk-hi-O9W"/>
|
||||
<outlet property="indicatorView" destination="hU9-MW-Akt" id="Uan-Ly-a2e"/>
|
||||
<outlet property="metaDataStackView" destination="7nK-bC-Tne" id="Lxn-sC-KND"/>
|
||||
<outlet property="topSeparator" destination="SL4-aj-tqQ" id="rvS-Xg-MX3"/>
|
||||
</connections>
|
||||
</collectionViewCell>
|
||||
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="MainTimelineCellStandard" id="IAy-I8-WCD" customClass="MainTimelineCollectionViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="223" width="414" height="52"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<collectionViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="XET-nk-8aM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="52"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Xv5-5u-3Vn">
|
||||
<rect key="frame" x="40" y="0.0" width="358" height="1"/>
|
||||
<color key="backgroundColor" systemColor="separatorColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="pVV-Vf-3qj"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2MF-aw-4ll" customClass="IconView" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="16" y="8" width="16" height="16"/>
|
||||
<color key="backgroundColor" systemColor="secondarySystemBackgroundColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="16" id="8FY-j5-vcP"/>
|
||||
<constraint firstAttribute="width" constant="16" id="czz-8J-tBw"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Article Content" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lrQ-Ly-avR">
|
||||
<rect key="frame" x="40" y="6" width="358" height="20"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" alignment="center" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="T9P-hq-hgD">
|
||||
<rect key="frame" x="40" y="28" width="358" height="14.5"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="authorByLine" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Jfc-Zl-24e">
|
||||
<rect key="frame" x="0.0" y="0.0" width="178" height="14.5"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
|
||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="articleDate" textAlignment="right" lineBreakMode="wordWrap" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vMX-RB-dH5">
|
||||
<rect key="frame" x="180" y="0.0" width="178" height="14.5"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
|
||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</stackView>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="egH-1Y-mdZ"/>
|
||||
<constraints>
|
||||
<constraint firstItem="Xv5-5u-3Vn" firstAttribute="leading" secondItem="lrQ-Ly-avR" secondAttribute="leading" id="0dS-FA-lYK"/>
|
||||
<constraint firstItem="egH-1Y-mdZ" firstAttribute="trailing" secondItem="T9P-hq-hgD" secondAttribute="trailing" constant="16" id="2Jl-GP-jrc"/>
|
||||
<constraint firstItem="Xv5-5u-3Vn" firstAttribute="top" secondItem="egH-1Y-mdZ" secondAttribute="top" id="B5U-TG-gmS"/>
|
||||
<constraint firstItem="lrQ-Ly-avR" firstAttribute="top" secondItem="egH-1Y-mdZ" secondAttribute="top" constant="6" id="LU6-1g-ZSx"/>
|
||||
<constraint firstItem="2MF-aw-4ll" firstAttribute="top" secondItem="egH-1Y-mdZ" secondAttribute="top" constant="8" id="PDh-GX-jYi"/>
|
||||
<constraint firstItem="egH-1Y-mdZ" firstAttribute="trailing" secondItem="lrQ-Ly-avR" secondAttribute="trailing" constant="16" id="Uwt-S5-k0M"/>
|
||||
<constraint firstItem="lrQ-Ly-avR" firstAttribute="leading" secondItem="2MF-aw-4ll" secondAttribute="trailing" constant="8" symbolic="YES" id="W57-aK-68T"/>
|
||||
<constraint firstItem="T9P-hq-hgD" firstAttribute="leading" secondItem="lrQ-Ly-avR" secondAttribute="leading" id="YAx-YQ-9RL"/>
|
||||
<constraint firstItem="T9P-hq-hgD" firstAttribute="top" secondItem="lrQ-Ly-avR" secondAttribute="bottom" constant="2" id="apb-eS-MZH"/>
|
||||
<constraint firstItem="2MF-aw-4ll" firstAttribute="leading" secondItem="egH-1Y-mdZ" secondAttribute="leading" constant="16" id="g4T-3b-s95"/>
|
||||
<constraint firstItem="egH-1Y-mdZ" firstAttribute="bottom" secondItem="T9P-hq-hgD" secondAttribute="bottom" constant="9.3333333333333357" id="pqU-hx-Zel"/>
|
||||
<constraint firstItem="Xv5-5u-3Vn" firstAttribute="trailing" secondItem="lrQ-Ly-avR" secondAttribute="trailing" id="tCn-LP-bGk"/>
|
||||
</constraints>
|
||||
</collectionViewCellContentView>
|
||||
<size key="customSize" width="414" height="52"/>
|
||||
<connections>
|
||||
<outlet property="articleByLine" destination="Jfc-Zl-24e" id="QWn-wx-l2d"/>
|
||||
<outlet property="articleContent" destination="lrQ-Ly-avR" id="D6w-wM-jK1"/>
|
||||
<outlet property="articleDate" destination="vMX-RB-dH5" id="lmW-Og-kTC"/>
|
||||
<outlet property="indicatorView" destination="2MF-aw-4ll" id="l98-1j-pka"/>
|
||||
<outlet property="metaDataStackView" destination="T9P-hq-hgD" id="PpE-8m-0aV"/>
|
||||
<outlet property="topSeparator" destination="Xv5-5u-3Vn" id="9Jx-Ud-nw2"/>
|
||||
</connections>
|
||||
</collectionViewCell>
|
||||
</cells>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="XEX-9Z-nVH" id="Ioc-M7-xcT"/>
|
||||
|
||||
@@ -71,6 +71,8 @@ class TimelineCustomizerCollectionViewController: UICollectionViewController {
|
||||
withReuseIdentifier: TimelineHeaderView.reuseIdentifier
|
||||
)
|
||||
|
||||
collectionView.register(MainTimelineCell.self, forCellWithReuseIdentifier: MainTimelineCell.reuseIdentifier)
|
||||
|
||||
var config = UICollectionLayoutListConfiguration(appearance: .insetGrouped)
|
||||
config.showsSeparators = false
|
||||
config.headerMode = .supplementary
|
||||
@@ -106,7 +108,7 @@ class TimelineCustomizerCollectionViewController: UICollectionViewController {
|
||||
}
|
||||
|
||||
if indexPath.section == 2 {
|
||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "MainTimelineCellStandard", for: indexPath) as! MainTimelineCollectionViewCell
|
||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: MainTimelineCell.reuseIdentifier, for: indexPath) as! MainTimelineCell
|
||||
cell.cellData = MainTimelineCellData(article: previewArticle,
|
||||
showFeedName: .byline,
|
||||
feedName: "The Fellowship of the Ring",
|
||||
@@ -120,7 +122,7 @@ class TimelineCustomizerCollectionViewController: UICollectionViewController {
|
||||
}
|
||||
|
||||
if indexPath.section == 3 {
|
||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "MainTimelineCellIcon", for: indexPath) as! MainTimelineCollectionViewCell
|
||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: MainTimelineCell.reuseIdentifier, for: indexPath) as! MainTimelineCell
|
||||
cell.cellData = MainTimelineCellData(article: previewArticle,
|
||||
showFeedName: .byline,
|
||||
feedName: "The Fellowship of the Ring",
|
||||
@@ -133,7 +135,7 @@ class TimelineCustomizerCollectionViewController: UICollectionViewController {
|
||||
return cell
|
||||
}
|
||||
|
||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "MainTimelineCellStandard", for: indexPath)
|
||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: MainTimelineCell.reuseIdentifier, for: indexPath)
|
||||
return cell
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user