Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Sources/ToastView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ open class ToastView: UIView {
set { self.backgroundView.layer.cornerRadius = newValue }
}

/// The background view's width
@objc open dynamic var backgroundWidth: NSNumber?

/// The inset of the text label.
@objc open dynamic var textInsets = UIEdgeInsets(top: 6, left: 10, bottom: 6, right: 10)

Expand Down Expand Up @@ -185,7 +188,7 @@ open class ToastView: UIView {
self.backgroundView.frame = CGRect(
x: 0,
y: 0,
width: self.textLabel.frame.size.width + self.textInsets.left + self.textInsets.right,
width: self.backgroundWidth?.doubleValue ?? self.textLabel.frame.size.width + self.textInsets.left + self.textInsets.right,
height: self.textLabel.frame.size.height + self.textInsets.top + self.textInsets.bottom
)

Expand Down