/
GlyptodonDistrib.swift
1201 lines (844 loc) · 28.5 KB
/
GlyptodonDistrib.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//
// Glyptodon
//
// A UI widget for displaying 'no results' message in iOS
//
// https://github.com/marketplacer/glyptodon
//
// This file was automatically generated by combining multiple Swift source files.
//
// ----------------------------
//
// Glyptodon.swift
//
// ----------------------------
import UIKit
/**
Glyptodon object is for showing and hiding of the message view.
The instance is created automatically in the `glyptodon` property of any UIView instance.
It is not expected to be instantiated manually anywhere except in unit tests.
For example:
let view = UIView()
view.glyptodon.show("No messages")
*/
final public class Glyptodon {
fileprivate weak var superview: UIView!
var didFinishShowAnimation: (()->())? // Called after the show animation is finished. Used in unit tests
var didFinishHideAnimation: (()->())? // Called after hide animation is finished. Used in unit tests
init(superview: UIView) {
self.superview = superview
}
/// Defines styles for the view.
public var style = GlyptodonStyle()
/**
Shows the message view with a title.
- parameter title: The text message to be shown.
*/
public func show(_ title: String, withAnimation: Bool = true) {
let currentExistingViews = existingViews
let view = GlyptodonView(style: style)
view.showInSuperview(superview, title: title, withAnimation: withAnimation,
didFinishAnimation: { [weak self] in
// Remove previously shown views after this view finished animating
Glyptodon.removeViews(currentExistingViews)
self?.didFinishShowAnimation?()
}
)
}
/**
Shows the message view with a title and a button.
- parameter title: The text message to be shown.
- parameter withButton: The title for the button
- parameter didTap: A closure that will be called when the button is tapped.
*/
public func show(_ title: String, withButton button: String, withAnimation: Bool = true,
didTap: @escaping ()->()) {
let currentExistingViews = existingViews
let view = GlyptodonView(style: style)
view.showInSuperview(superview, title: title, withButton: button,
withAnimation: withAnimation, didTapButton: didTap,
didFinishAnimation: { [weak self] in
// Remove previously shown views after this view finished animating
Glyptodon.removeViews(currentExistingViews)
self?.didFinishShowAnimation?()
}
)
}
/// Hide the message window if it's currently open.
public func hide(withAnimation: Bool = true) {
let viewToHide = existingViews
for (index, view) in viewToHide.enumerated() {
let topView = index == viewToHide.count - 1
let useAnimation = topView ? withAnimation : false // Animate only top view
view.hide(withAnimation: useAnimation) { [weak self] in
if topView {
self?.didFinishHideAnimation?()
}
}
}
}
/// Check if the message view is currently visible.
public var visible: Bool {
get {
if let glyptodonView = glyptodonView {
return !glyptodonView.beingHidden
}
return false
}
}
/// Returns the currently displayed title label.
public var titleLabel: UILabel? {
get {
return glyptodonView?.subviews.filter { $0 is UILabel }.map { $0 as! UILabel }.first
}
}
/// Returns the button.
public var button: UIButton? {
get {
return glyptodonView?.subviews.filter { $0 is UIButton }.map { $0 as! UIButton }.first
}
}
fileprivate var glyptodonView: GlyptodonView? {
get {
return existingViews.last
}
}
fileprivate var existingViews: [GlyptodonView] {
return superview.subviews.filter { $0 is GlyptodonView }.map { $0 as! GlyptodonView }
}
fileprivate class func removeViews(_ views: [UIView]) {
for view in views {
view.removeFromSuperview()
}
}
}
// ----------------------------
//
// GlyptodonView.swift
//
// ----------------------------
import UIKit
class GlyptodonView: UIView {
var style: GlyptodonStyle
/// Shows if the view is being hidden
var beingHidden = false
/// Button tap closure supplied by the user
var didTapButtonHandler: (()->())?
convenience init(style: GlyptodonStyle) {
self.init(frame: CGRect())
self.style = style
}
override init(frame: CGRect) {
style = GlyptodonStyle()
super.init(frame: frame)
}
required init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func showInSuperview(_ superview: UIView, title: String, withAnimation: Bool,
didFinishAnimation: @escaping ()->()) {
superview.addSubview(self)
addLayoutConstraints()
createTitle(title)
applyStyle()
if withAnimation {
animateIn() { didFinishAnimation() }
} else {
didFinishAnimation()
}
}
func showInSuperview(_ superview: UIView, title: String,
withButton buttonTitle: String, withAnimation: Bool, didTapButton: @escaping ()->(),
didFinishAnimation: @escaping ()->()) {
showInSuperview(superview, title: title, withAnimation: withAnimation,
didFinishAnimation: didFinishAnimation)
self.didTapButtonHandler = didTapButton
createButton(buttonTitle)
}
func hide(withAnimation: Bool, didFinishAnimation: @escaping ()->()) {
if beingHidden {
didFinishAnimation()
return
}
beingHidden = true
if withAnimation {
animateOut() { [weak self] in
self?.removeFromSuperview()
didFinishAnimation()
}
} else {
removeFromSuperview()
didFinishAnimation()
}
}
fileprivate func applyStyle() {
backgroundColor = style.view.backgroundColor
}
fileprivate func addLayoutConstraints() {
guard let superview = superview else { return }
translatesAutoresizingMaskIntoConstraints = false
// Fill the message view to covert entire area of its superview
TegAutolayoutConstraints.fillParent(self, parentView: superview, margin: 0, vertically: true)
TegAutolayoutConstraints.fillParent(self, parentView: superview, margin: 0, vertically: false)
}
fileprivate var titleLabel: UILabel? {
return subviews.filter { $0 is UILabel }.map { $0 as! UILabel }.first
}
// MARK: - Title
fileprivate func createTitle(_ title: String) {
let label = UILabel()
addSubview(label)
label.text = title
addTitleLayoutConstraints(label)
applyTitleStyle(label)
}
fileprivate func addTitleLayoutConstraints(_ label: UILabel) {
label.translatesAutoresizingMaskIntoConstraints = false
// Make the width of the title label the same as the view, minus the margins.
TegAutolayoutConstraints.fillParent(label, parentView: self,
margin: style.title.horizontalMargin, vertically: false)
// Center the label vertically in the view with an offset.
TegAutolayoutConstraints.centerY(label, viewTwo: self, constraintContainer: self,
constant: style.title.verticalOffset)
}
fileprivate func applyTitleStyle(_ label: UILabel) {
label.textAlignment = .center
label.font = style.title.font
label.textColor = style.title.color
label.numberOfLines = style.title.numberOfLines
label.shadowColor = style.title.shadowColor
label.shadowOffset = style.title.shadowOffset
}
// MARK: - Button
fileprivate func createButton(_ title: String) {
let button = UIButton()
addSubview(button)
button.setTitle(title, for: UIControlState())
addButtonLayoutConstraints(button)
applyButtonStyle(button)
setupTapHandler(button)
}
fileprivate func addButtonLayoutConstraints(_ button: UIButton) {
guard let titleLabel = titleLabel else { return }
button.translatesAutoresizingMaskIntoConstraints = false
// Make the width of the button the same as the view, minus the margins.
TegAutolayoutConstraints.fillParent(button, parentView: self, margin: style.title.horizontalMargin, vertically: false)
// Position the button under the title label
TegAutolayoutConstraints.twoViewsNextToEachOther(titleLabel, viewTwo: button, constraintContainer: self, margin: 20, vertically: true)
}
fileprivate func applyButtonStyle(_ button: UIButton) {
button.setTitleColor(style.button.color, for: UIControlState())
button.setTitleColor(style.button.colorHighlighted, for: .highlighted)
button.setTitleShadowColor(style.button.shadowColor, for: UIControlState())
guard let label = button.titleLabel else { return }
label.font = style.button.font
label.numberOfLines = style.button.numberOfLines
label.shadowOffset = style.button.shadowOffset
}
fileprivate func setupTapHandler(_ button: UIButton) {
button.addTarget(self, action: #selector(GlyptodonView.didTapButton(_:)), for: .touchUpInside)
}
func didTapButton(_ button: UIButton) {
didTapButtonHandler?()
}
// MARK: - Animation
fileprivate func animateIn(_ didFinishAnimation: @escaping ()->()) {
alpha = 0
UIView.animate(withDuration: style.view.animationDurationSeconds,
animations: { [weak self] in
self?.alpha = 1
},
completion: { _ in
didFinishAnimation()
}
)
}
fileprivate func animateOut(_ didFinishAnimation: @escaping ()->()) {
UIView.animate(withDuration: style.view.animationDurationSeconds,
animations: { [weak self] in
self?.alpha = 0
},
completion: { _ in
didFinishAnimation()
}
)
}
}
// ----------------------------
//
// GlyptodonButtonDefaultStyles.swift
//
// ----------------------------
import UIKit
/**
Default styles for the button.
Default styles are used when individual element styles are not set.
*/
public struct GlyptodonButtonDefaultStyles {
/// Revert the property values to their defaults
public static func resetToDefaults() {
color = _color
colorHighlighted = _colorHighlighted
font = _font
horizontalMargin = _horizontalMargin
numberOfLines = _numberOfLines
shadowColor = _shadowColor
shadowOffset = _shadowOffset
verticalMargin = _verticalMargin
}
// ---------------------------
fileprivate static let _color: UIColor = GlyptodonColor.fromHexString("#007AFF")
/// Color of the button title.
public static var color = _color
// ---------------------------
fileprivate static let _colorHighlighted: UIColor = GlyptodonColor.fromHexString("#007AFF33")
/// Color of the button title when it's tapped.
public static var colorHighlighted = _colorHighlighted
// ---------------------------
fileprivate static let _font = UIFont.preferredFont(forTextStyle: UIFontTextStyle.body)
/// Font of the button title.
public static var font = _font
// ---------------------------
fileprivate static let _horizontalMargin: CGFloat = 15
/// Horizontal margin between the button and the edge of the view.
public static var horizontalMargin = _horizontalMargin
// ---------------------------
fileprivate static let _numberOfLines: Int = 5
/// The maximum number of lines in the button title.
public static var numberOfLines = _numberOfLines
// ---------------------------
fileprivate static let _shadowColor: UIColor? = nil
/// Color of text shadow.
public static var shadowColor = _shadowColor
// ---------------------------
fileprivate static let _shadowOffset = CGSize(width: 0, height: 1)
/// Text shadow offset.
public static var shadowOffset = _shadowOffset
// ---------------------------
fileprivate static let _verticalMargin: CGFloat = 20
/// Vertical margin between the title and the button.
public static var verticalMargin = _verticalMargin
// ---------------------------
}
// ----------------------------
//
// GlyptodonButtonStyle.swift
//
// ----------------------------
import UIKit
/// Defines styles related to the button.
open class GlyptodonButtonStyle {
/// Clears the styles for all properties for this style object. Default styles will be used instead.
open func clear() {
_color = nil
_colorHighlighted = nil
_font = nil
_horizontalMargin = nil
_numberOfLines = nil
_shadowColor = nil
_shadowOffset = nil
_verticalMargin = nil
}
// -----------------------------
fileprivate var _color: UIColor?
/// Color of the button title.
open var color: UIColor {
get {
return _color ?? GlyptodonButtonDefaultStyles.color
}
set {
_color = newValue
}
}
// -----------------------------
fileprivate var _colorHighlighted: UIColor?
/// Color of the button title when it's tapped.
open var colorHighlighted: UIColor {
get {
return _colorHighlighted ?? GlyptodonButtonDefaultStyles.colorHighlighted
}
set {
_colorHighlighted = newValue
}
}
// -----------------------------
fileprivate var _font: UIFont?
/// Font of the button title.
open var font: UIFont {
get {
return _font ?? GlyptodonButtonDefaultStyles.font
}
set {
_font = newValue
}
}
// -----------------------------
fileprivate var _horizontalMargin: CGFloat?
/// Horizontal margin between the button and the edge of the view.
open var horizontalMargin: CGFloat {
get {
return _horizontalMargin ?? GlyptodonButtonDefaultStyles.horizontalMargin
}
set {
_horizontalMargin = newValue
}
}
// -----------------------------
fileprivate var _numberOfLines: Int?
/// The maximum number of lines in the button title.
open var numberOfLines: Int {
get {
return _numberOfLines ?? GlyptodonButtonDefaultStyles.numberOfLines
}
set {
_numberOfLines = newValue
}
}
// -----------------------------
fileprivate var _shadowColor: UIColor?
/// Color of text shadow.
open var shadowColor: UIColor? {
get {
return _shadowColor ?? GlyptodonButtonDefaultStyles.shadowColor
}
set {
_shadowColor = newValue
}
}
// -----------------------------
fileprivate var _shadowOffset: CGSize?
/// Text shadow offset.
open var shadowOffset: CGSize {
get {
return _shadowOffset ?? GlyptodonButtonDefaultStyles.shadowOffset
}
set {
_shadowOffset = newValue
}
}
// -----------------------------
fileprivate var _verticalMargin: CGFloat?
/// Vertical margin between the title and the button.
open var verticalMargin: CGFloat {
get {
return _verticalMargin ?? GlyptodonButtonDefaultStyles.verticalMargin
}
set {
_verticalMargin = newValue
}
}
// -----------------------------
}
// ----------------------------
//
// GlyptodonStyle.swift
//
// ----------------------------
import UIKit
/// Combines various styles for the toolbar element.
open class GlyptodonStyle {
/**
Reverts all the default styles to their initial values. Usually used in setUp() function in the unit tests.
*/
open static func resetDefaultStyles() {
GlyptodonViewDefaultStyles.resetToDefaults()
GlyptodonTitleDefaultStyles.resetToDefaults()
}
/// Clears the styles for all properties for this style object. The styles will be taken from parent and default properties.
open func clear() {
view.clear()
}
/**
Styles for the view.
*/
open lazy var view = GlyptodonViewStyle()
/**
Styles for the title text.
*/
open lazy var title = GlyptodonTitleStyle()
/**
Styles for the button.
*/
open lazy var button = GlyptodonButtonStyle()
}
// ----------------------------
//
// GlyptodonTitleDefaultStyles.swift
//
// ----------------------------
import UIKit
/**
Default styles for the title label.
Default styles are used when individual element styles are not set.
*/
public struct GlyptodonTitleDefaultStyles {
/// Revert the property values to their defaults
public static func resetToDefaults() {
color = _color
font = _font
horizontalMargin = _horizontalMargin
verticalOffset = _verticalOffset
numberOfLines = _numberOfLines
shadowColor = _shadowColor
shadowOffset = _shadowOffset
}
// ---------------------------
fileprivate static let _color = GlyptodonColor.fromHexString("#666666")
/// Color of the title text.
public static var color = _color
// ---------------------------
fileprivate static let defaultNonDynamicFontSize: CGFloat = 28
fileprivate static let _font: UIFont = {
if #available(iOS 8.2, *) {
if #available(iOS 9.0, *) {
// Use dynamic type font for accessibility when available
return UIFont.preferredFont(forTextStyle: UIFontTextStyle.title1)
} else {
return UIFont.systemFont(ofSize: defaultNonDynamicFontSize, weight: UIFontWeightLight)
}
} else {
return UIFont.systemFont(ofSize: defaultNonDynamicFontSize)
}
}()
/// Font of the title text.
public static var font = _font
// ---------------------------
fileprivate static let _horizontalMargin: CGFloat = 15
/// Horizontal margin between the title and the edge of the view.
public static var horizontalMargin = _horizontalMargin
// ---------------------------
fileprivate static let _numberOfLines: Int = 5
/// The maximum number of lines in the title.
public static var numberOfLines = _numberOfLines
// ---------------------------
fileprivate static let _shadowColor: UIColor? = nil
/// Color of text shadow.
public static var shadowColor = _shadowColor
// ---------------------------
fileprivate static let _shadowOffset = CGSize(width: 0, height: 1)
/// Text shadow offset.
public static var shadowOffset = _shadowOffset
// ---------------------------
fileprivate static let _verticalOffset: CGFloat = 0
/// Vertical offset of the title relative to the center of the view. If zero the label is aligned exactly at the center.
public static var verticalOffset = _verticalOffset
// ---------------------------
}
// ----------------------------
//
// GlyptodonTitleStyle.swift
//
// ----------------------------
import UIKit
/// Defines styles related to the title label.
open class GlyptodonTitleStyle {
/// Clears the styles for all properties for this style object. Default styles will be used instead.
open func clear() {
_color = nil
_font = nil
_horizontalMargin = nil
_numberOfLines = nil
_shadowColor = nil
_shadowOffset = nil
_verticalOffset = nil
}
// -----------------------------
fileprivate var _color: UIColor?
/// Color of the title text.
open var color: UIColor {
get {
return _color ?? GlyptodonTitleDefaultStyles.color
}
set {
_color = newValue
}
}
// -----------------------------
fileprivate var _font: UIFont?
/// Color of the title text.
open var font: UIFont {
get {
return _font ?? GlyptodonTitleDefaultStyles.font
}
set {
_font = newValue
}
}
// -----------------------------
fileprivate var _horizontalMargin: CGFloat?
/// Horizontal margin between the title and the edge of the view.
open var horizontalMargin: CGFloat {
get {
return _horizontalMargin ?? GlyptodonTitleDefaultStyles.horizontalMargin
}
set {
_horizontalMargin = newValue
}
}
// -----------------------------
fileprivate var _numberOfLines: Int?
/// The maximum number of lines in the title.
open var numberOfLines: Int {
get {
return _numberOfLines ?? GlyptodonTitleDefaultStyles.numberOfLines
}
set {
_numberOfLines = newValue
}
}
// -----------------------------
fileprivate var _shadowColor: UIColor?
/// Color of text shadow.
open var shadowColor: UIColor? {
get {
return _shadowColor ?? GlyptodonTitleDefaultStyles.shadowColor
}
set {
_shadowColor = newValue
}
}
// -----------------------------
fileprivate var _shadowOffset: CGSize?
/// Text shadow offset.
open var shadowOffset: CGSize {
get {
return _shadowOffset ?? GlyptodonTitleDefaultStyles.shadowOffset
}
set {
_shadowOffset = newValue
}
}
// -----------------------------
fileprivate var _verticalOffset: CGFloat?
/// Vertical offset of the title relative to the center of the view. If zero the label is aligned exactly at the center.
open var verticalOffset: CGFloat {
get {
return _verticalOffset ?? GlyptodonTitleDefaultStyles.verticalOffset
}
set {
_verticalOffset = newValue
}
}
// -----------------------------
}
// ----------------------------
//
// GlyptodonViewDefaultStyles.swift
//
// ----------------------------
import UIKit
/**
Default styles for the view.
Default styles are used when individual element styles are not set.
*/
public struct GlyptodonViewDefaultStyles {
/// Revert the property values to their defaults
public static func resetToDefaults() {
animationDurationSeconds = _animationDurationSeconds
backgroundColor = _backgroundColor
}
// ---------------------------
fileprivate static let _animationDurationSeconds: TimeInterval = 0.3
/// Duration of the fade animation that is used to show and hide the message view. Setting it to 0 will result in no animation.
public static var animationDurationSeconds = _animationDurationSeconds
// ---------------------------
fileprivate static let _backgroundColor: UIColor? = GlyptodonColor.fromHexString("#EEEEEE")
/// Background color of the message view.
public static var backgroundColor = _backgroundColor
// ---------------------------
}
// ----------------------------
//
// GlyptodonViewStyle.swift
//
// ----------------------------
import UIKit
/// Defines styles related to the view in general.
open class GlyptodonViewStyle {
/// Clears the styles for all properties for this style object. Default styles will be used instead.
open func clear() {
_backgroundColor = nil
}
// ---------------------------
fileprivate var _animationDurationSeconds: TimeInterval?
/// Duration of the fade animation that is used to show and hide the message view. Setting it to 0 will result in no animation.
open var animationDurationSeconds: TimeInterval {
get {
return _animationDurationSeconds ?? GlyptodonViewDefaultStyles.animationDurationSeconds
}
set {
_animationDurationSeconds = newValue
}
}
// -----------------------------
fileprivate var _backgroundColor: UIColor?
/// Background color of the message view.
open var backgroundColor: UIColor? {
get {
return _backgroundColor ?? GlyptodonViewDefaultStyles.backgroundColor
}
set {
_backgroundColor = newValue
}
}
// ---------------------------
}
// ----------------------------
//
// UIView+Glyptodon.swift
//
// ----------------------------
import UIKit
private var sabAssociationKey: UInt8 = 0
/**
UIView extension for showing a 'no content' message.
let view = UIView()
view.glyptodon.show("Shopping cart is empty")
*/