Skip to content

Commit 0617939

Browse files
committed
Debugging and documentation
1 parent c3a0b55 commit 0617939

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+569
-648
lines changed

Demo/Demo/Base.lproj/LaunchScreen.storyboard

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
2525
<nil key="highlightedColor"/>
2626
</label>
27-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="SwiftMessages" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iEm-gV-LFh">
27+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="SwiftMessages" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iEm-gV-LFh">
2828
<rect key="frame" x="238" y="250" width="123" height="21"/>
2929
<fontDescription key="fontDescription" type="system" pointSize="18"/>
3030
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>

Demo/Demo/Base.lproj/Main.storyboard

+11-10
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,13 @@
134134
<autoresizingMask key="autoresizingMask"/>
135135
<subviews>
136136
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="PRESENTATION STYLE" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Epw-Yk-L8V">
137-
<rect key="frame" x="18" y="8" width="147" height="16"/>
137+
<rect key="frame" x="17.5" y="8" width="147" height="16"/>
138138
<fontDescription key="fontDescription" type="boldSystem" pointSize="13"/>
139139
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
140140
<nil key="highlightedColor"/>
141141
</label>
142142
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="Agu-Vo-ckI">
143-
<rect key="frame" x="18" y="29" width="119" height="29"/>
143+
<rect key="frame" x="18" y="28.5" width="119" height="29"/>
144144
<segments>
145145
<segment title="Top"/>
146146
<segment title="Bottom"/>
@@ -165,7 +165,7 @@
165165
<autoresizingMask key="autoresizingMask"/>
166166
<subviews>
167167
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="PRESENTATION CONTEXT" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CU0-87-ZCD">
168-
<rect key="frame" x="18" y="8" width="169" height="16"/>
168+
<rect key="frame" x="17.5" y="8" width="169" height="16"/>
169169
<fontDescription key="fontDescription" type="boldSystem" pointSize="13"/>
170170
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
171171
<nil key="highlightedColor"/>
@@ -230,7 +230,7 @@
230230
<autoresizingMask key="autoresizingMask"/>
231231
<subviews>
232232
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="DIM MODE" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TsP-n5-Vko">
233-
<rect key="frame" x="18" y="8" width="69" height="16"/>
233+
<rect key="frame" x="18" y="8" width="68.5" height="16"/>
234234
<fontDescription key="fontDescription" type="boldSystem" pointSize="13"/>
235235
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
236236
<nil key="highlightedColor"/>
@@ -335,9 +335,10 @@
335335
<nil key="highlightedColor"/>
336336
</label>
337337
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="NoM-It-vKT">
338-
<rect key="frame" x="18" y="29" width="259" height="29"/>
338+
<rect key="frame" x="18" y="29" width="329" height="29"/>
339339
<segments>
340340
<segment title="Info"/>
341+
<segment title="Success"/>
341342
<segment title="Warning"/>
342343
<segment title="Error"/>
343344
<segment title="Custom"/>
@@ -362,13 +363,13 @@
362363
<autoresizingMask key="autoresizingMask"/>
363364
<subviews>
364365
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="DROP SHADOW" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MUL-on-v9R">
365-
<rect key="frame" x="18" y="8" width="102" height="16"/>
366+
<rect key="frame" x="18" y="8" width="101.5" height="16"/>
366367
<fontDescription key="fontDescription" type="boldSystem" pointSize="13"/>
367368
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
368369
<nil key="highlightedColor"/>
369370
</label>
370371
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="sqb-Fg-YR8">
371-
<rect key="frame" x="533" y="1" width="51" height="31"/>
372+
<rect key="frame" x="533" y="0.5" width="51" height="31"/>
372373
</switch>
373374
</subviews>
374375
<constraints>
@@ -397,7 +398,7 @@
397398
<autoresizingMask key="autoresizingMask"/>
398399
<subviews>
399400
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="TITLE" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zs0-Qc-Tls">
400-
<rect key="frame" x="18" y="8" width="47" height="16"/>
401+
<rect key="frame" x="18" y="8" width="46.5" height="16"/>
401402
<fontDescription key="fontDescription" type="boldSystem" pointSize="13"/>
402403
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
403404
<nil key="highlightedColor"/>
@@ -570,8 +571,8 @@
570571
<action selector="show:" destination="NF9-wZ-lbZ" eventType="touchUpInside" id="M1F-VO-IXP"/>
571572
</connections>
572573
</button>
573-
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vaB-mE-Rve">
574-
<rect key="frame" x="66" y="0.0" width="59" height="33"/>
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"/>
575576
<color key="backgroundColor" red="0.85507499631818185" green="0.14286500584919343" blue="0.13053950878691239" alpha="1" colorSpace="calibratedRGB"/>
576577
<fontDescription key="fontDescription" type="boldSystem" pointSize="13"/>
577578
<state key="normal" title="HIDE"/>

Demo/Demo/ExploreViewController.swift

+9-7
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ class ExploreViewController: UITableViewController, UITextFieldDelegate {
2929

3030
switch theme.selectedSegmentIndex {
3131
case 0:
32-
view.configureInfoTheme()
32+
view.configureTheme(.Info)
3333
case 1:
34-
view.configureWarningTheme()
34+
view.configureTheme(.Success)
3535
case 2:
36-
view.configureErrorTheme()
36+
view.configureTheme(.Warning)
37+
case 3:
38+
view.configureTheme(.Error)
3739
default:
3840
view.configureTheme(backgroundColor: UIColor.purpleColor(), foregroundColor: UIColor.whiteColor(), iconImage: nil, iconText: "🐸")
3941
view.button?.setImage(Icon.ErrorSubtle.image, forState: .Normal)
@@ -95,9 +97,9 @@ class ExploreViewController: UITableViewController, UITextFieldDelegate {
9597

9698
switch dimMode.selectedSegmentIndex {
9799
case 1:
98-
config.dimMode = .Automatic(interactive: false)
100+
config.dimMode = .Gray(interactive: false)
99101
case 2:
100-
config.dimMode = .Automatic(interactive: true)
102+
config.dimMode = .Gray(interactive: true)
101103
default:
102104
break
103105
}
@@ -106,9 +108,9 @@ class ExploreViewController: UITableViewController, UITextFieldDelegate {
106108

107109
// Set status bar style unless using card view (since it doesn't
108110
// go behind the status bar).
109-
if layout.selectedSegmentIndex != 1 {
111+
if case .Top = config.presentationStyle where layout.selectedSegmentIndex != 1 {
110112
switch theme.selectedSegmentIndex {
111-
case 1...3:
113+
case 1...4:
112114
config.preferredStatusBarStyle = .LightContent
113115
default:
114116
break

Demo/Demo/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<key>CFBundleInfoDictionaryVersion</key>
1212
<string>6.0</string>
1313
<key>CFBundleName</key>
14-
<string>$(PRODUCT_NAME)</string>
14+
<string>SM Demo</string>
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>

Demo/Demo/ViewController.swift

+22-11
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,35 @@ class ViewController: UITableViewController {
5656
static func demoBasics() -> Void {
5757

5858
let error = MessageView.viewFromNib(layout: .MessageView)
59-
error.configureErrorTheme()
59+
error.configureTheme(.Error)
6060
error.configureContent(title: "Error", body: "Something is horribly wrong!")
6161
error.button?.setTitle("Stop", forState: .Normal)
6262
error.iconContainer?.hidden = true
6363

6464
let warning = MessageView.viewFromNib(layout: .CardView)
65-
warning.configureWarningTheme()
65+
warning.configureTheme(.Warning)
6666
warning.configureDropShadow()
6767
warning.configureContent(title: "Warning", body: "Consider yourself warned.", iconText: "🤔")
6868
warning.button?.hidden = true
6969
var warningConfig = SwiftMessages.Config()
7070
warningConfig.presentationContext = .Window(windowLevel: UIWindowLevelStatusBar)
71-
71+
72+
let success = MessageView.viewFromNib(layout: .CardView)
73+
success.configureTheme(.Success)
74+
success.configureDropShadow()
75+
success.configureContent(title: "Success", body: "Something good happened!")
76+
success.button?.hidden = true
77+
var successConfig = SwiftMessages.Config()
78+
successConfig.presentationStyle = .Bottom
79+
successConfig.presentationContext = .Window(windowLevel: UIWindowLevelNormal)
80+
7281
let info = MessageView.viewFromNib(layout: .MessageView)
73-
info.configureInfoTheme()
82+
info.configureTheme(.Info)
7483
info.button?.hidden = true
7584
info.configureContent(title: "Info", body: "This is a very lengthy and informative info message that wraps across multiple lines and grows in height as needed.")
7685
var infoConfig = SwiftMessages.Config()
7786
infoConfig.presentationStyle = .Bottom
87+
infoConfig.duration = .Seconds(seconds: 0.25)
7888

7989
let status = MessageView.viewFromNib(layout: .StatusLine)
8090
status.backgroundView.backgroundColor = UIColor.purpleColor()
@@ -93,6 +103,7 @@ class ViewController: UITableViewController {
93103

94104
SwiftMessages.show(view: error)
95105
SwiftMessages.show(config: warningConfig, view: warning)
106+
SwiftMessages.show(config: successConfig, view: success)
96107
SwiftMessages.show(config: infoConfig, view: info)
97108
SwiftMessages.show(config: statusConfig, view: status)
98109
SwiftMessages.show(config: status2Config, view: status2)
@@ -103,14 +114,14 @@ class ViewController: UITableViewController {
103114
imageView.image = UIImage(named: "puppies")
104115
imageView.contentMode = .ScaleAspectFill
105116
imageView.clipsToBounds = true
106-
let shadowView = DropShadowView()
107-
shadowView.installView(imageView)
108-
shadowView.configureDropShadow()
109-
shadowView.constrainHeight(120.0)
110-
shadowView.backgroundColor = UIColor.redColor()
117+
let f = CGRectMake(100, 100, 100, 100)
118+
let messageView = BaseView(frame: f)
119+
messageView.installContentView(imageView)
120+
messageView.preferredHeight = 120.0
121+
messageView.configureDropShadow()
111122
var config = SwiftMessages.Config()
112123
config.presentationContext = .Window(windowLevel: UIWindowLevelStatusBar)
113-
SwiftMessages.show(config: config, view: shadowView)
124+
SwiftMessages.show(config: config, view: messageView)
114125
}
115126

116127
static func demoCustomNib() {
@@ -122,7 +133,7 @@ class ViewController: UITableViewController {
122133
config.presentationContext = .Window(windowLevel: UIWindowLevelStatusBar)
123134
config.duration = .Forever
124135
config.presentationStyle = .Bottom
125-
config.dimMode = .Automatic(interactive: true)
136+
config.dimMode = .Gray(interactive: true)
126137
SwiftMessages.show(config: config, view: view)
127138
}
128139

Demo/Podfile.lock

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

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

1111
SPEC CHECKSUMS:
12-
SwiftMessages: 7a34dc56ce9d8e7d624195d5295281f092471254
12+
SwiftMessages: c987edae29bba1d390bb2596e5f19a68598de7a6
1313

1414
PODFILE CHECKSUM: 6431c980c9207084d738b6ba87b2101dd9eb5097
1515

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

+3-3
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)