Skip to content

Commit 33c0f1e

Browse files
committed
Add icon style support
Add support for specifying an `IconStyle` in the `MessageView.configureTheme()` convenience function.
1 parent b7b4221 commit 33c0f1e

File tree

16 files changed

+226
-175
lines changed

16 files changed

+226
-175
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## [1.0.2](https://github.com/SwiftKickMobile/SwiftMessages/releases/tag/1.0.2)
5+
6+
### Feature
7+
8+
* Add support for specifying an `IconStyle` in the `MessageView.configureTheme()` convenience function.
9+
410
## [1.0.1](https://github.com/SwiftKickMobile/SwiftMessages/releases/tag/1.0.1)
511

612
* Add code comments.

Demo/Demo/Base.lproj/Main.storyboard

+41-8
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
<objects>
121121
<tableViewController id="NF9-wZ-lbZ" customClass="ExploreViewController" customModule="Demo" customModuleProvider="target" sceneMemberID="viewController">
122122
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="none" allowsSelection="NO" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="XwA-eF-0LG">
123-
<rect key="frame" x="0.0" y="0.0" width="600" height="1000"/>
123+
<rect key="frame" x="0.0" y="0.0" width="600" height="1200"/>
124124
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
125125
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
126126
<sections>
@@ -355,8 +355,40 @@
355355
</constraints>
356356
</tableViewCellContentView>
357357
</tableViewCell>
358+
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="65" id="0mE-sA-4rN" userLabel="Theme cell">
359+
<rect key="frame" x="0.0" y="599" width="600" height="65"/>
360+
<autoresizingMask key="autoresizingMask"/>
361+
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="0mE-sA-4rN" id="eVs-bm-01A">
362+
<rect key="frame" x="0.0" y="0.0" width="600" height="65"/>
363+
<autoresizingMask key="autoresizingMask"/>
364+
<subviews>
365+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ICON STYLE" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sXY-rl-8uH">
366+
<rect key="frame" x="18" y="8" width="79" height="16"/>
367+
<fontDescription key="fontDescription" type="boldSystem" pointSize="13"/>
368+
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
369+
<nil key="highlightedColor"/>
370+
</label>
371+
<segmentedControl opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="c2K-94-CuB">
372+
<rect key="frame" x="29" y="29" width="309" height="29"/>
373+
<segments>
374+
<segment title="Regular"/>
375+
<segment title="Light"/>
376+
<segment title="Subtle"/>
377+
</segments>
378+
</segmentedControl>
379+
</subviews>
380+
<constraints>
381+
<constraint firstItem="c2K-94-CuB" firstAttribute="leading" secondItem="eVs-bm-01A" secondAttribute="leadingMargin" constant="10" id="57X-r6-yn8"/>
382+
<constraint firstItem="sXY-rl-8uH" firstAttribute="top" secondItem="eVs-bm-01A" secondAttribute="topMargin" id="aNb-k2-SZY"/>
383+
<constraint firstItem="c2K-94-CuB" firstAttribute="top" secondItem="sXY-rl-8uH" secondAttribute="bottom" constant="5" id="euE-AS-gZT"/>
384+
<constraint firstAttribute="bottomMargin" relation="greaterThanOrEqual" secondItem="c2K-94-CuB" secondAttribute="bottom" id="ifY-M2-nQa"/>
385+
<constraint firstAttribute="trailingMargin" relation="greaterThanOrEqual" secondItem="c2K-94-CuB" secondAttribute="trailing" constant="10" id="jMs-A0-qxE"/>
386+
<constraint firstItem="sXY-rl-8uH" firstAttribute="leading" secondItem="eVs-bm-01A" secondAttribute="leadingMargin" constant="10" id="rCc-O8-QkU"/>
387+
</constraints>
388+
</tableViewCellContentView>
389+
</tableViewCell>
358390
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="4RW-U9-BVB" userLabel="Drop shadow cell">
359-
<rect key="frame" x="0.0" y="599" width="600" height="44"/>
391+
<rect key="frame" x="0.0" y="664" width="600" height="44"/>
360392
<autoresizingMask key="autoresizingMask"/>
361393
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="4RW-U9-BVB" id="wdb-hX-CIv">
362394
<rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
@@ -391,7 +423,7 @@
391423
<tableViewSection headerTitle="CONTENT" id="Mih-L6-PeE">
392424
<cells>
393425
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="65" id="ddI-Jn-NgP" userLabel="Title cell">
394-
<rect key="frame" x="0.0" y="694" width="600" height="65"/>
426+
<rect key="frame" x="0.0" y="759" width="600" height="65"/>
395427
<autoresizingMask key="autoresizingMask"/>
396428
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="ddI-Jn-NgP" id="4HG-zA-HtF">
397429
<rect key="frame" x="0.0" y="0.0" width="600" height="65"/>
@@ -420,7 +452,7 @@
420452
</tableViewCellContentView>
421453
</tableViewCell>
422454
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="65" id="bdE-R5-mtF" userLabel="Subtitle cell">
423-
<rect key="frame" x="0.0" y="759" width="600" height="65"/>
455+
<rect key="frame" x="0.0" y="824" width="600" height="65"/>
424456
<autoresizingMask key="autoresizingMask"/>
425457
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="bdE-R5-mtF" id="E8h-YG-8UX">
426458
<rect key="frame" x="0.0" y="0.0" width="600" height="65"/>
@@ -449,7 +481,7 @@
449481
</tableViewCellContentView>
450482
</tableViewCell>
451483
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="110" id="i0m-Xn-tMe" userLabel="Hiding cell">
452-
<rect key="frame" x="0.0" y="824" width="600" height="110"/>
484+
<rect key="frame" x="0.0" y="889" width="600" height="110"/>
453485
<autoresizingMask key="autoresizingMask"/>
454486
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="i0m-Xn-tMe" id="y4L-XO-6WY">
455487
<rect key="frame" x="0.0" y="0.0" width="600" height="110"/>
@@ -571,8 +603,8 @@
571603
<action selector="show:" destination="NF9-wZ-lbZ" eventType="touchUpInside" id="M1F-VO-IXP"/>
572604
</connections>
573605
</button>
574-
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vaB-mE-Rve">
575-
<rect key="frame" x="65.5" y="0.0" width="59.5" height="33"/>
606+
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vaB-mE-Rve">
607+
<rect key="frame" x="66" y="0.0" width="59" height="33"/>
576608
<color key="backgroundColor" red="0.85507499631818185" green="0.14286500584919343" blue="0.13053950878691239" alpha="1" colorSpace="calibratedRGB"/>
577609
<fontDescription key="fontDescription" type="boldSystem" pointSize="13"/>
578610
<state key="normal" title="HIDE"/>
@@ -601,12 +633,13 @@
601633
</barButtonItem>
602634
</navigationItem>
603635
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
604-
<size key="freeformSize" width="600" height="1000"/>
636+
<size key="freeformSize" width="600" height="1200"/>
605637
<connections>
606638
<outlet property="bodyText" destination="Ev4-j7-wY0" id="mD6-Ge-qJY"/>
607639
<outlet property="dimMode" destination="iw9-KB-Nyd" id="OiP-ss-kEO"/>
608640
<outlet property="dropShadow" destination="sqb-Fg-YR8" id="zUz-6P-IFz"/>
609641
<outlet property="duration" destination="nng-9a-v3B" id="4VC-Yi-AiA"/>
642+
<outlet property="iconStyle" destination="c2K-94-CuB" id="Qwt-xY-oZ2"/>
610643
<outlet property="interactiveHide" destination="Vdr-7b-DJB" id="pEi-RT-l7U"/>
611644
<outlet property="layout" destination="aBT-5M-2tg" id="4GZ-iP-oCa"/>
612645
<outlet property="presentationContext" destination="AYG-qj-yjv" id="oxG-AK-tTF"/>

Demo/Demo/ExploreViewController.swift

+15-4
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,25 @@ class ExploreViewController: UITableViewController, UITextFieldDelegate {
2727

2828
view.configureContent(title: titleText.text, body: bodyText.text, iconImage: nil, iconText: nil, buttonImage: nil, buttonTitle: "Hide", buttonTapHandler: { _ in SwiftMessages.hide() })
2929

30+
let iconStyle: IconStyle
31+
switch self.iconStyle.selectedSegmentIndex {
32+
case 1:
33+
iconStyle = .Light
34+
case 2:
35+
iconStyle = .Subtle
36+
default:
37+
iconStyle = .Default
38+
}
39+
3040
switch theme.selectedSegmentIndex {
3141
case 0:
32-
view.configureTheme(.Info)
42+
view.configureTheme(.Info, iconStyle: iconStyle)
3343
case 1:
34-
view.configureTheme(.Success)
44+
view.configureTheme(.Success, iconStyle: iconStyle)
3545
case 2:
36-
view.configureTheme(.Warning)
46+
view.configureTheme(.Warning, iconStyle: iconStyle)
3747
case 3:
38-
view.configureTheme(.Error)
48+
view.configureTheme(.Error, iconStyle: iconStyle)
3949
default:
4050
view.configureTheme(backgroundColor: UIColor.purpleColor(), foregroundColor: UIColor.whiteColor(), iconImage: nil, iconText: "🐸")
4151
view.button?.setImage(Icon.ErrorSubtle.image, forState: .Normal)
@@ -132,6 +142,7 @@ class ExploreViewController: UITableViewController, UITextFieldDelegate {
132142
@IBOutlet weak var interactiveHide: UISwitch!
133143
@IBOutlet weak var layout: UISegmentedControl!
134144
@IBOutlet weak var theme: UISegmentedControl!
145+
@IBOutlet weak var iconStyle: UISegmentedControl!
135146
@IBOutlet weak var dropShadow: UISwitch!
136147
@IBOutlet weak var titleText: UITextField!
137148
@IBOutlet weak var bodyText: UITextField!

Demo/Podfile.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PODS:
2-
- SwiftMessages (1.0.0)
2+
- SwiftMessages (1.0.2)
33

44
DEPENDENCIES:
55
- SwiftMessages (from `../`)
@@ -9,7 +9,7 @@ EXTERNAL SOURCES:
99
:path: ../
1010

1111
SPEC CHECKSUMS:
12-
SwiftMessages: c987edae29bba1d390bb2596e5f19a68598de7a6
12+
SwiftMessages: 443e1aef4889ba28c31d0d4dd53e63d3fe5ae119
1313

1414
PODFILE CHECKSUM: 6431c980c9207084d738b6ba87b2101dd9eb5097
1515

Demo/Pods/Local Podspecs/SwiftMessages.podspec.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Demo/Pods/Manifest.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)