Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions Sources/ToastSwift/ToastSwift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ open class ToastSwift: Operation {

@objc public var delay: TimeInterval = 0
@objc public var duration: TimeInterval = 2.0
@objc public var action: (() -> Void)?

private var _executing = false
override public var isExecuting: Bool {
Expand Down Expand Up @@ -63,17 +64,19 @@ open class ToastSwift: Operation {
// MARK: Initializing

@MainActor
@objc public init(text: String? = nil, willHideActionButton: Bool = true, delay: TimeInterval = 0, duration: TimeInterval = Delay.short) {
@objc public init(text: String? = nil, backgroundColor: UIColor = UIColor(red: 0.24, green: 0.24, blue: 0.24, alpha: 1.00), willHideActionButton: Bool = true, delay: TimeInterval = 0, duration: TimeInterval = Delay.short) {
self.delay = delay
self.duration = duration
self.view.backgroundColor = backgroundColor
super.init()
self.text = text
}

@MainActor
@objc public init(attributedText: NSAttributedString?, willHideActionButton: Bool = true, delay: TimeInterval = 0, duration: TimeInterval = Delay.short) {
@objc public init(attributedText: NSAttributedString?, backgroundColor: UIColor = UIColor(red: 0.24, green: 0.24, blue: 0.24, alpha: 1.00), willHideActionButton: Bool = true, delay: TimeInterval = 0, duration: TimeInterval = Delay.short) {
self.delay = delay
self.duration = duration
self.view.backgroundColor = backgroundColor
super.init()
self.attributedText = attributedText
}
Expand Down
5 changes: 2 additions & 3 deletions Sources/ToastSwift/ToastView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ open class ToastView: UIView {

private lazy var backgroundView: UIView = {
let `self` = UIView()
self.backgroundColor = UIColor(red: 0.24, green: 0.24, blue: 0.24, alpha: 1.00)
self.layer.cornerRadius = 16
self.layer.masksToBounds = false
self.layer.shadowPath = UIBezierPath(rect: self.bounds).cgPath
Expand All @@ -126,7 +125,7 @@ open class ToastView: UIView {

private lazy var textLabel: UILabel = {
let `self` = UILabel()
self.textColor = .white
self.textColor = .black
self.backgroundColor = .clear
self.font = UIFont.systemFont(ofSize: 13.5)
self.numberOfLines = 0
Expand Down Expand Up @@ -161,7 +160,7 @@ open class ToastView: UIView {
self.addSubview(self.backgroundView)
self.addSubview(self.columnStackView)
self.columnStackView.addArrangedSubview(self.textLabel)
self.columnStackView.addArrangedSubview(self.actionTextLabel)
// self.columnStackView.addArrangedSubview(self.actionTextLabel)

let actionLabelAttribute: [NSAttributedString.Key : Any] = [
NSAttributedString.Key.font: UIFont(name: "SFProDisplay-Medium", size: 13.5),
Expand Down
Loading