Displaying added date in vehicle cell

This commit is contained in:
Selim Mustafaev 2021-03-19 23:58:09 +03:00
parent da8d45488e
commit fb7fe1e22e
3 changed files with 117 additions and 71 deletions

View File

@ -847,7 +847,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 67;
CURRENT_PROJECT_VERSION = 68;
DEVELOPMENT_TEAM = 46DTTB8X4S;
INFOPLIST_FILE = AutoCat/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
@ -871,7 +871,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 67;
CURRENT_PROJECT_VERSION = 68;
DEVELOPMENT_TEAM = 46DTTB8X4S;
INFOPLIST_FILE = AutoCat/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;

View File

@ -100,14 +100,14 @@
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="EventCell" id="QIb-Hv-tvk" customClass="EventCell" customModule="AutoCat" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="375" height="125"/>
<rect key="frame" x="0.0" y="28" width="375" height="125.5"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="QIb-Hv-tvk" id="Ypt-ch-fGT">
<rect key="frame" x="0.0" y="0.0" width="375" height="125"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="125.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="HP8-oO-yhP">
<rect key="frame" x="8" y="8" width="359" height="109"/>
<rect key="frame" x="8" y="8" width="359" height="109.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xcQ-Wz-gJ0">
<rect key="frame" x="0.0" y="0.0" width="359" height="50"/>
@ -116,7 +116,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1tQ-zM-6T9">
<rect key="frame" x="0.0" y="58" width="359" height="51"/>
<rect key="frame" x="0.0" y="58" width="359" height="51.5"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleSubhead"/>
<color key="textColor" systemColor="secondaryLabelColor"/>
<nil key="highlightedColor"/>
@ -196,49 +196,66 @@
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="VehicleCell" id="VEP-QD-i6y" customClass="VehicleCell" customModule="AutoCat" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="375" height="64.5"/>
<rect key="frame" x="0.0" y="28" width="375" height="85"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="VEP-QD-i6y" id="8hH-8I-XLB">
<rect key="frame" x="0.0" y="0.0" width="375" height="64.5"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="85"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AQY-7N-q8D">
<rect key="frame" x="8" y="8" width="0.0" height="0.5"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="RPA-NR-0C6">
<rect key="frame" x="367" y="8" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<color key="textColor" systemColor="secondaryLabelColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cvf-vM-QnT" customClass="PlateView" customModule="AutoCat" customModuleProvider="target">
<rect key="frame" x="8" y="16.5" width="317" height="40"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="Xoz-Iw-PCU"/>
</constraints>
</view>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="E0H-HY-s2L">
<rect key="frame" x="8" y="8" width="359" height="69"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Kia Optima" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AQY-7N-q8D">
<rect key="frame" x="0.0" y="0.0" width="359" height="20.5"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" tag="8" contentMode="scaleToFill" alignment="bottom" translatesAutoresizingMaskIntoConstraints="NO" id="vMC-Bk-8rZ">
<rect key="frame" x="0.0" y="28.5" width="359" height="40.5"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="cvf-vM-QnT" customClass="PlateView" customModule="AutoCat" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.5" width="303" height="40"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="Xoz-Iw-PCU"/>
</constraints>
</view>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="bottom" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="quG-e3-h5v">
<rect key="frame" x="303" y="0.5" width="56" height="40"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" text="1.01.2021" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="RPA-NR-0C6">
<rect key="frame" x="0.0" y="0.0" width="56" height="16"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<color key="textColor" systemColor="secondaryLabelColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aOM-gr-Yem">
<rect key="frame" x="23" y="24" width="33" height="16"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<color key="textColor" systemColor="tertiaryLabelColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
</subviews>
</stackView>
</subviews>
</stackView>
</subviews>
<constraints>
<constraint firstItem="RPA-NR-0C6" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="AQY-7N-q8D" secondAttribute="trailing" constant="8" id="AB5-Fg-dMQ"/>
<constraint firstItem="AQY-7N-q8D" firstAttribute="top" secondItem="8hH-8I-XLB" secondAttribute="top" constant="8" id="FiA-ZH-YN0"/>
<constraint firstItem="RPA-NR-0C6" firstAttribute="top" secondItem="8hH-8I-XLB" secondAttribute="top" constant="8" id="JyS-ht-gyH"/>
<constraint firstAttribute="trailing" secondItem="RPA-NR-0C6" secondAttribute="trailing" constant="8" id="Ki4-ca-I55"/>
<constraint firstAttribute="bottom" secondItem="cvf-vM-QnT" secondAttribute="bottom" constant="8" id="NoD-uC-htT"/>
<constraint firstItem="cvf-vM-QnT" firstAttribute="leading" secondItem="8hH-8I-XLB" secondAttribute="leading" constant="8" id="aO8-6i-9jc"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="cvf-vM-QnT" secondAttribute="trailing" constant="8" id="ipf-aR-tuv"/>
<constraint firstItem="AQY-7N-q8D" firstAttribute="leading" secondItem="8hH-8I-XLB" secondAttribute="leading" constant="8" id="lJ4-uW-IwQ"/>
<constraint firstItem="cvf-vM-QnT" firstAttribute="top" secondItem="AQY-7N-q8D" secondAttribute="bottom" constant="8" id="qh7-O4-4d1"/>
<constraint firstAttribute="bottom" secondItem="E0H-HY-s2L" secondAttribute="bottom" constant="8" id="Ijr-HL-UZx"/>
<constraint firstItem="E0H-HY-s2L" firstAttribute="top" secondItem="8hH-8I-XLB" secondAttribute="top" constant="8" id="SbP-00-gE3"/>
<constraint firstItem="E0H-HY-s2L" firstAttribute="leading" secondItem="8hH-8I-XLB" secondAttribute="leading" constant="8" id="V57-T6-4bW"/>
<constraint firstAttribute="trailing" secondItem="E0H-HY-s2L" secondAttribute="trailing" constant="8" id="hxm-tH-1Ja"/>
</constraints>
</tableViewCellContentView>
<inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
<connections>
<outlet property="date" destination="RPA-NR-0C6" id="ih3-3R-Y8J"/>
<outlet property="addedDate" destination="aOM-gr-Yem" id="aQL-6B-r1G"/>
<outlet property="name" destination="AQY-7N-q8D" id="hSi-Nh-mc2"/>
<outlet property="plate" destination="cvf-vM-QnT" id="8Bm-gA-bbm"/>
<outlet property="updatedDate" destination="RPA-NR-0C6" id="c0e-Ew-Bc3"/>
</connections>
</tableViewCell>
</prototypes>
@ -505,49 +522,66 @@
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="VehicleCell" id="3ON-lr-UlV" customClass="VehicleCell" customModule="AutoCat" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="375" height="64.5"/>
<rect key="frame" x="0.0" y="28" width="375" height="85"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="3ON-lr-UlV" id="IGw-UK-ebp">
<rect key="frame" x="0.0" y="0.0" width="375" height="64.5"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="85"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="h3N-1o-J20">
<rect key="frame" x="8" y="8" width="0.0" height="0.5"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rKr-3e-WYb">
<rect key="frame" x="367" y="8" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<color key="textColor" systemColor="secondaryLabelColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="VHX-o0-3BP" customClass="PlateView" customModule="AutoCat" customModuleProvider="target">
<rect key="frame" x="8" y="16.5" width="317" height="40"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="vzo-oF-mWb"/>
</constraints>
</view>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="6IZ-gM-D28">
<rect key="frame" x="8" y="8" width="359" height="69"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Kia Optima" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="h3N-1o-J20">
<rect key="frame" x="0.0" y="0.0" width="359" height="20.5"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" alignment="bottom" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="nX1-KA-jqp">
<rect key="frame" x="0.0" y="28.5" width="359" height="40.5"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="VHX-o0-3BP" customClass="PlateView" customModule="AutoCat" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.5" width="295" height="40"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="vzo-oF-mWb"/>
</constraints>
</view>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="bottom" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="ApN-fV-Qw4">
<rect key="frame" x="303" y="0.5" width="56" height="40"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" text="1.01.2021" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rKr-3e-WYb">
<rect key="frame" x="0.0" y="0.0" width="56" height="16"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<color key="textColor" systemColor="secondaryLabelColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UOb-db-Sty">
<rect key="frame" x="23" y="24" width="33" height="16"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<color key="textColor" systemColor="tertiaryLabelColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
</subviews>
</stackView>
</subviews>
</stackView>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="VHX-o0-3BP" secondAttribute="bottom" constant="8" id="7hb-rB-XFk"/>
<constraint firstItem="rKr-3e-WYb" firstAttribute="top" secondItem="IGw-UK-ebp" secondAttribute="top" constant="8" id="Aae-DJ-RWv"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="VHX-o0-3BP" secondAttribute="trailing" constant="8" id="CNo-ir-xoh"/>
<constraint firstAttribute="trailing" secondItem="rKr-3e-WYb" secondAttribute="trailing" constant="8" id="Efc-w5-0Xo"/>
<constraint firstItem="VHX-o0-3BP" firstAttribute="leading" secondItem="IGw-UK-ebp" secondAttribute="leading" constant="8" id="PgR-8A-drv"/>
<constraint firstItem="VHX-o0-3BP" firstAttribute="top" secondItem="h3N-1o-J20" secondAttribute="bottom" constant="8" id="U0q-5Z-FxE"/>
<constraint firstItem="h3N-1o-J20" firstAttribute="leading" secondItem="IGw-UK-ebp" secondAttribute="leading" constant="8" id="eqF-fX-u0u"/>
<constraint firstItem="rKr-3e-WYb" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="h3N-1o-J20" secondAttribute="trailing" constant="8" id="h98-lu-Lji"/>
<constraint firstItem="h3N-1o-J20" firstAttribute="top" secondItem="IGw-UK-ebp" secondAttribute="top" constant="8" id="yx2-fR-etv"/>
<constraint firstAttribute="trailing" secondItem="6IZ-gM-D28" secondAttribute="trailing" constant="8" id="Ku8-6L-Frz"/>
<constraint firstAttribute="bottom" secondItem="6IZ-gM-D28" secondAttribute="bottom" constant="8" id="NF3-s6-87u"/>
<constraint firstItem="6IZ-gM-D28" firstAttribute="top" secondItem="IGw-UK-ebp" secondAttribute="top" constant="8" id="WfT-Jn-Yx1"/>
<constraint firstItem="6IZ-gM-D28" firstAttribute="leading" secondItem="IGw-UK-ebp" secondAttribute="leading" constant="8" id="zPI-NI-EuK"/>
</constraints>
</tableViewCellContentView>
<inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
<connections>
<outlet property="date" destination="rKr-3e-WYb" id="TOr-YS-0IE"/>
<outlet property="addedDate" destination="UOb-db-Sty" id="oVf-sZ-fdF"/>
<outlet property="name" destination="h3N-1o-J20" id="jcM-B4-bEJ"/>
<outlet property="plate" destination="VHX-o0-3BP" id="D8N-L7-O8b"/>
<outlet property="updatedDate" destination="rKr-3e-WYb" id="RpZ-NF-Bcg"/>
</connections>
</tableViewCell>
</prototypes>
@ -926,5 +960,8 @@
<systemColor name="systemTealColor">
<color red="0.35294117647058826" green="0.78431372549019607" blue="0.98039215686274506" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="tertiaryLabelColor">
<color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.29999999999999999" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>

View File

@ -4,7 +4,8 @@ class VehicleCell: UITableViewCell, ConfigurableCell {
@IBOutlet weak var name: UILabel!
@IBOutlet weak var plate: PlateView!
@IBOutlet weak var date: UILabel!
@IBOutlet weak var addedDate: UILabel!
@IBOutlet weak var updatedDate: UILabel!
let formatter = DateFormatter()
@ -25,7 +26,15 @@ class VehicleCell: UITableViewCell, ConfigurableCell {
} else {
self.plate.foreground = nil
}
self.date.text = formatter.string(from: Date(timeIntervalSince1970: vehicle.addedDate))
}
if vehicle.updatedDate - vehicle.addedDate > 60 {
self.addedDate.text = formatter.string(from: Date(timeIntervalSince1970: vehicle.addedDate))
self.updatedDate.text = formatter.string(from: Date(timeIntervalSince1970: vehicle.updatedDate))
self.addedDate.isHidden = false
} else {
self.addedDate.isHidden = true
self.updatedDate.text = formatter.string(from: Date(timeIntervalSince1970: vehicle.updatedDate))
}
}
}