Skip to content

Commit a3f50f5

Browse files
committed
Improve default layouts
1 parent b2af6d4 commit a3f50f5

File tree

6 files changed

+143
-49
lines changed

6 files changed

+143
-49
lines changed

Demo/Demo.xcodeproj/project.pbxproj

+2
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@
431431
PRODUCT_BUNDLE_IDENTIFIER = it.swiftkick.Demo;
432432
PRODUCT_NAME = "$(TARGET_NAME)";
433433
SWIFT_VERSION = 5.0;
434+
TARGETED_DEVICE_FAMILY = "1,2";
434435
};
435436
name = Debug;
436437
};
@@ -446,6 +447,7 @@
446447
PRODUCT_BUNDLE_IDENTIFIER = it.swiftkick.Demo;
447448
PRODUCT_NAME = "$(TARGET_NAME)";
448449
SWIFT_VERSION = 5.0;
450+
TARGETED_DEVICE_FAMILY = "1,2";
449451
};
450452
name = Release;
451453
};

SwiftMessages/Resources/CardView.xib

+37-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
3-
<device id="retina4_7" orientation="portrait">
3+
<device id="retina6_1" orientation="portrait">
44
<adaptation id="fullscreen"/>
55
</device>
66
<dependencies>
@@ -12,17 +12,17 @@
1212
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
1313
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
1414
<view contentMode="scaleToFill" id="uEa-1P-F1Y" userLabel="Card View" customClass="MessageView" customModule="SwiftMessages">
15-
<rect key="frame" x="0.0" y="0.0" width="600" height="160"/>
15+
<rect key="frame" x="0.0" y="0.0" width="510" height="160"/>
1616
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1717
<subviews>
1818
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="A7b-0a-fJG" userLabel="Corner rounding view" customClass="CornerRoundingView" customModule="SwiftMessages" customModuleProvider="target">
19-
<rect key="frame" x="20" y="0.0" width="560" height="160"/>
19+
<rect key="frame" x="20" y="44" width="470" height="82"/>
2020
<subviews>
2121
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="SU0-uJ-4pP" userLabel="Content view">
22-
<rect key="frame" x="20" y="20" width="520" height="120"/>
22+
<rect key="frame" x="20" y="20" width="430" height="42"/>
2323
<subviews>
2424
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" horizontalCompressionResistancePriority="752" text="😬" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="T1i-ce-9y8" userLabel="Icon label">
25-
<rect key="frame" x="0.0" y="37.5" width="43" height="45.5"/>
25+
<rect key="frame" x="0.0" y="0.0" width="43" height="42"/>
2626
<accessibility key="accessibilityConfiguration">
2727
<bool key="isElement" value="NO"/>
2828
</accessibility>
@@ -31,10 +31,10 @@
3131
<nil key="highlightedColor"/>
3232
</label>
3333
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="252" verticalHuggingPriority="251" horizontalCompressionResistancePriority="752" image="errorIcon" translatesAutoresizingMaskIntoConstraints="NO" id="RxA-tv-YM7" userLabel="Icon image view">
34-
<rect key="frame" x="53" y="52" width="16" height="16"/>
34+
<rect key="frame" x="53" y="13" width="16" height="16"/>
3535
</imageView>
3636
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="top" translatesAutoresizingMaskIntoConstraints="NO" id="i9r-ex-CgT">
37-
<rect key="frame" x="79" y="41" width="374" height="38.5"/>
37+
<rect key="frame" x="79" y="2" width="284" height="38.5"/>
3838
<subviews>
3939
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="[Title]" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8HR-oh-U9F">
4040
<rect key="frame" x="0.0" y="0.0" width="48.5" height="20.5"/>
@@ -59,32 +59,46 @@
5959
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
6060
</stackView>
6161
<button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="252" horizontalCompressionResistancePriority="752" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="CxK-Y3-nSI">
62-
<rect key="frame" x="463" y="45" width="57" height="30"/>
62+
<rect key="frame" x="373" y="6" width="57" height="30"/>
6363
<fontDescription key="fontDescription" style="UICTFontTextStyleSubhead"/>
6464
<state key="normal" title="[Button]"/>
6565
</button>
6666
</subviews>
67+
<variation key="widthClass=regular" spacing="15"/>
6768
</stackView>
6869
</subviews>
6970
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
7071
<constraints>
7172
<constraint firstAttribute="trailing" secondItem="SU0-uJ-4pP" secondAttribute="trailing" constant="20" id="QN2-NH-rWA"/>
7273
<constraint firstItem="SU0-uJ-4pP" firstAttribute="top" secondItem="A7b-0a-fJG" secondAttribute="top" constant="20" id="S9l-zM-0wc"/>
7374
<constraint firstAttribute="bottom" secondItem="SU0-uJ-4pP" secondAttribute="bottom" constant="20" id="YMg-LN-n7f"/>
75+
<constraint firstAttribute="width" relation="lessThanOrEqual" priority="900" constant="500" id="lOa-jP-2uX"/>
7476
<constraint firstItem="SU0-uJ-4pP" firstAttribute="leading" secondItem="A7b-0a-fJG" secondAttribute="leading" constant="20" id="nYJ-Ok-uhC"/>
7577
</constraints>
7678
<userDefinedRuntimeAttributes>
7779
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
7880
<real key="value" value="15"/>
7981
</userDefinedRuntimeAttribute>
8082
</userDefinedRuntimeAttributes>
83+
<variation key="default">
84+
<mask key="constraints">
85+
<exclude reference="lOa-jP-2uX"/>
86+
</mask>
87+
</variation>
88+
<variation key="widthClass=regular">
89+
<mask key="constraints">
90+
<include reference="lOa-jP-2uX"/>
91+
</mask>
92+
</variation>
8193
</view>
8294
</subviews>
8395
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
8496
<constraints>
97+
<constraint firstItem="A7b-0a-fJG" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="uEa-1P-F1Y" secondAttribute="leadingMargin" priority="900" id="LWV-wo-Jec"/>
8598
<constraint firstAttribute="trailingMargin" secondItem="A7b-0a-fJG" secondAttribute="trailing" priority="900" id="O6e-Yz-cwK"/>
8699
<constraint firstItem="A7b-0a-fJG" firstAttribute="leading" secondItem="uEa-1P-F1Y" secondAttribute="leadingMargin" priority="900" id="RiR-2q-ZY5"/>
87100
<constraint firstItem="A7b-0a-fJG" firstAttribute="centerX" secondItem="uEa-1P-F1Y" secondAttribute="centerX" priority="950" id="jLv-ud-1WD"/>
101+
<constraint firstAttribute="trailingMargin" relation="greaterThanOrEqual" secondItem="A7b-0a-fJG" secondAttribute="trailing" priority="900" id="lGg-Ey-I5f"/>
88102
<constraint firstItem="A7b-0a-fJG" firstAttribute="top" secondItem="uEa-1P-F1Y" secondAttribute="topMargin" id="yAH-C4-oUg"/>
89103
<constraint firstAttribute="bottomMargin" secondItem="A7b-0a-fJG" secondAttribute="bottom" id="ygs-aa-zj3"/>
90104
</constraints>
@@ -107,6 +121,20 @@
107121
</userDefinedRuntimeAttribute>
108122
<userDefinedRuntimeAttribute type="boolean" keyPath="collapseLayoutMarginAdditions" value="YES"/>
109123
</userDefinedRuntimeAttributes>
124+
<variation key="default">
125+
<mask key="constraints">
126+
<exclude reference="LWV-wo-Jec"/>
127+
<exclude reference="lGg-Ey-I5f"/>
128+
</mask>
129+
</variation>
130+
<variation key="widthClass=regular">
131+
<mask key="constraints">
132+
<include reference="LWV-wo-Jec"/>
133+
<exclude reference="O6e-Yz-cwK"/>
134+
<exclude reference="RiR-2q-ZY5"/>
135+
<include reference="lGg-Ey-I5f"/>
136+
</mask>
137+
</variation>
110138
<connections>
111139
<outlet property="backgroundView" destination="A7b-0a-fJG" id="R1k-6D-zIA"/>
112140
<outlet property="bodyLabel" destination="9oc-qg-igL" id="ebS-73-kbp"/>
@@ -115,7 +143,7 @@
115143
<outlet property="iconLabel" destination="T1i-ce-9y8" id="XiD-0J-kdm"/>
116144
<outlet property="titleLabel" destination="8HR-oh-U9F" id="Zbb-wl-ubV"/>
117145
</connections>
118-
<point key="canvasLocation" x="484" y="387"/>
146+
<point key="canvasLocation" x="510.35156249999994" y="386.96925329428984"/>
119147
</view>
120148
</objects>
121149
<resources>

0 commit comments

Comments
 (0)