Skip to content

Commit 56e480e

Browse files
author
Evan Greer
committed
updates default font for title and body
1 parent 9d55465 commit 56e480e

File tree

1 file changed

+81
-106
lines changed

1 file changed

+81
-106
lines changed

swift-sdk/uicomponents/IterableEmbeddedView.swift

Lines changed: 81 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public class IterableEmbeddedView:UIView {
5858
didSet {
5959
if let title = embeddedMessageTitle {
6060
labelTitle.text = title
61+
labelTitle.font = UIFont.boldSystemFont(ofSize: 16.0)
6162
labelTitle.isHidden = false
6263
} else {
6364
labelTitle.isHidden = true
@@ -72,6 +73,7 @@ public class IterableEmbeddedView:UIView {
7273
didSet {
7374
if let body = embeddedMessageBody {
7475
labelDescription.text = body
76+
labelDescription.font = UIFont.systemFont(ofSize: 14.0)
7577
labelDescription.isHidden = false
7678
} else {
7779
labelDescription.isHidden = true
@@ -106,91 +108,81 @@ public class IterableEmbeddedView:UIView {
106108
/// Associated Embedded Message
107109
public var message: IterableEmbeddedMessage? = nil
108110

109-
// // MARK: OOTB View IBInspectables
110-
// /// OOTB View Background Color
111-
public var bannerBackgroundColor: UIColor = UIColor.white
112-
// @IBInspectable public var bannerBackgroundColor: UIColor? = UIColor.white {
113-
// didSet {
114-
// self.backgroundColor = UIColor.clear
115-
// self.innerContentView.backgroundColor = backgroundColor!
116-
// }
117-
// }
118-
//
119-
// /// Banner Border Color
120-
public var bannerBorderColor: UIColor = UIColor.clear
121-
// @IBInspectable public var bannerBorderColor: UIColor = UIColor.clear {
122-
// didSet {
123-
// self.layer.borderColor = bannerBorderColor.cgColor
124-
// }
125-
// }
126-
//
127-
// /// Banner Border Width
128-
public var bannerBorderWidth: CGFloat = 1.0
129-
// @IBInspectable public var bannerBorderWidth: CGFloat = 1.0 {
130-
// didSet {
131-
// self.layer.borderWidth = bannerBorderWidth
132-
// }
133-
// }
134-
//
135-
// /// Banner Corner Radius
136-
public var bannerCornerRadius: CGFloat = 8.0
137-
// @IBInspectable public var bannerCornerRadius: CGFloat = 8.0 {
138-
// didSet {
139-
// self.layer.cornerRadius = bannerCornerRadius
140-
// contentView.layer.cornerRadius = bannerCornerRadius
141-
// innerContentView.layer.cornerRadius = bannerCornerRadius
142-
// }
143-
// }
144-
//
145-
// // MARK: Primary Button
146-
// /// Primary button background color.
147-
public var primaryBtnColor: UIColor = UIColor.purple
148-
// @IBInspectable public var primaryBtnColor: UIColor = UIColor.purple {
149-
// didSet {
150-
// primaryBtn.backgroundColor = primaryBtnColor
151-
// }
152-
// }
153-
//
154-
// /// Primary button text color.
155-
public var primaryBtnTextColor: UIColor = UIColor.white
156-
// @IBInspectable public var primaryBtnTextColor: UIColor = UIColor.white {
157-
// didSet {
158-
// primaryBtn.titleColor = primaryBtnTextColor
159-
// }
160-
// }
161-
//
162-
// // MARK: Second Button
163-
// /// Secondary button background color.
164-
public var secondaryBtnColor: UIColor = UIColor.clear
165-
// @IBInspectable public var secondaryBtnColor: UIColor = UIColor.clear {
166-
// didSet {
167-
// secondaryBtn.backgroundColor = secondaryBtnColor
168-
// }
169-
// }
170-
//
171-
// /// Secondary button text color.
172-
public var secondaryBtnTextColor: UIColor = UIColor.black
173-
// @IBInspectable public var secondaryBtnTextColor: UIColor = UIColor.black {
174-
// didSet {
175-
// secondaryBtn.titleColor = secondaryBtnTextColor
176-
// }
177-
// }
178-
//
179-
// /// Title Text Color
180-
public var titleTextColor: UIColor = UIColor.black
181-
// @IBInspectable public var titleTextColor: UIColor = UIColor.black {
182-
// didSet {
183-
// labelTitle.textColor = titleTextColor
184-
// }
185-
// }
186-
//
187-
// /// Description Text Color
188-
public var bodyTextColor: UIColor = UIColor.darkGray
189-
// @IBInspectable public var bodyTextColor: UIColor = UIColor.darkGray {
190-
// didSet {
191-
// labelDescription.textColor = bodyTextColor
192-
// }
193-
// }
111+
// MARK: OOTB View IBInspectables
112+
/// OOTB View Background Color
113+
public var ootbViewBackgroundColor: UIColor = UIColor.white {
114+
didSet {
115+
self.backgroundColor = UIColor.clear
116+
self.innerContentView.backgroundColor = ootbViewBackgroundColor
117+
}
118+
}
119+
120+
/// Banner Border Color
121+
public var ootbViewBorderColor: UIColor = UIColor(red: 0.88, green: 0.87, blue: 0.87, alpha: 1.00) {
122+
didSet {
123+
self.layer.borderColor = ootbViewBorderColor.cgColor
124+
}
125+
}
126+
127+
/// Banner Border Width
128+
public var ootbViewBorderWidth: CGFloat = 1.0 {
129+
didSet {
130+
self.layer.borderWidth = ootbViewBorderWidth
131+
}
132+
}
133+
134+
/// Banner Corner Radius
135+
public var ootbViewCornerRadius: CGFloat = 8.0 {
136+
didSet {
137+
self.layer.cornerRadius = ootbViewCornerRadius
138+
contentView.layer.cornerRadius = ootbViewCornerRadius
139+
innerContentView.layer.cornerRadius = ootbViewCornerRadius
140+
}
141+
}
142+
143+
// MARK: Primary Button
144+
/// Primary button background color.
145+
public var primaryBtnColor: UIColor = UIColor.purple {
146+
didSet {
147+
primaryBtn.backgroundColor = primaryBtnColor
148+
}
149+
}
150+
151+
/// Primary button text color.
152+
public var primaryBtnTextColor: UIColor = UIColor.white {
153+
didSet {
154+
primaryBtn.titleColor = primaryBtnTextColor
155+
}
156+
}
157+
158+
// MARK: Second Button
159+
/// Secondary button background color.
160+
public var secondaryBtnColor: UIColor = UIColor.clear {
161+
didSet {
162+
secondaryBtn.backgroundColor = secondaryBtnColor
163+
}
164+
}
165+
166+
/// Secondary button text color.
167+
public var secondaryBtnTextColor: UIColor = UIColor.black {
168+
didSet {
169+
secondaryBtn.titleColor = secondaryBtnTextColor
170+
}
171+
}
172+
173+
/// Title Text Color
174+
public var titleTextColor: UIColor = UIColor.black {
175+
didSet {
176+
labelTitle.textColor = titleTextColor
177+
}
178+
}
179+
180+
/// Description Text Color
181+
public var bodyTextColor: UIColor = UIColor.darkGray {
182+
didSet {
183+
labelDescription.textColor = bodyTextColor
184+
}
185+
}
194186

195187
// MARK: IterableEmbeddedView init method
196188
/// IterableEmbeddedView init method
@@ -209,7 +201,6 @@ public class IterableEmbeddedView:UIView {
209201
self.contentView = self.loadViewFromNib()
210202
self.contentView.translatesAutoresizingMaskIntoConstraints = false
211203
self.innerContentView.clipsToBounds = true
212-
//self.setDefaultValue()
213204
self.addSubview(self.contentView)
214205

215206
NSLayoutConstraint.activate([
@@ -223,26 +214,10 @@ public class IterableEmbeddedView:UIView {
223214
func loadViewFromNib() -> UIView? {
224215
let nib = UINib(nibName: "IterableEmbeddedView", bundle: Bundle.module)
225216
let view = nib.instantiate(withOwner: self, options: nil).first as? UIView
226-
//view?.backgroundColor = UIColor.clear
227217
self.clipsToBounds = false
228218
return view
229219
}
230220

231-
// MARK: Assign Default Value
232-
///setDefaultValue assign default values to IterableEmbeddedView
233-
// func setDefaultValue() {
234-
// bannerBackgroundColor = UIColor.white
235-
// bannerBorderColor = UIColor(red: 0.88, green: 0.87, blue: 0.87, alpha: 1.00)
236-
// bannerBorderWidth = 1.0
237-
// bannerCornerRadius = 8.0
238-
// primaryBtnColor = UIColor.purple
239-
// primaryBtnTextColor = UIColor.white
240-
// secondaryBtnColor = UIColor.clear
241-
// secondaryBtnTextColor = UIColor.black
242-
// titleTextColor = UIColor.black
243-
// bodyTextColor = UIColor.darkGray
244-
// }
245-
246221
public func configure(message: IterableEmbeddedMessage, viewType: IterableEmbeddedViewType, config: IterableEmbeddedViewConfig?) {
247222

248223
self.message = message
@@ -280,10 +255,10 @@ public class IterableEmbeddedView:UIView {
280255
let defaultTitleTextColor = (cardOrBanner) ? cardTitleTextColor : notificationTextColor
281256
let defaultBodyTextColor = (cardOrBanner) ? cardBodyTextColor : notificationTextColor
282257

283-
bannerBackgroundColor = config?.backgroundColor ?? defaultBackgroundColor
284-
bannerBorderColor = config?.borderColor ?? defaultBorderColor
285-
bannerBorderWidth = config?.borderWidth ?? 1.0
286-
bannerCornerRadius = config?.borderCornerRadius ?? 8.0
258+
ootbViewBackgroundColor = config?.backgroundColor ?? defaultBackgroundColor
259+
ootbViewBorderColor = config?.borderColor ?? defaultBorderColor
260+
ootbViewBorderWidth = config?.borderWidth ?? 1.0
261+
ootbViewCornerRadius = config?.borderCornerRadius ?? 8.0
287262
primaryBtnColor = config?.primaryBtnBackgroundColor ?? defaultPrimaryBtnColor
288263
primaryBtnTextColor = config?.primaryBtnTextColor ?? defaultPrimaryBtnTextColor
289264
secondaryBtnColor = config?.secondaryBtnBackgroundColor ?? defaultSecondaryBtnColor

0 commit comments

Comments
 (0)