Skip to content
Open
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
12 changes: 11 additions & 1 deletion Sources/Toast/ToastViewConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public struct ToastViewConfiguration {

public let textAlignment: UIStackView.Alignment

public let shadowOffset: CGSize
public let shadowColor: UIColor
public let shadowOpacity: Float

public init(
minHeight: CGFloat = 58,
minWidth: CGFloat = 150,
Expand All @@ -30,7 +34,10 @@ public struct ToastViewConfiguration {
titleNumberOfLines: Int = 1,
subtitleNumberOfLines: Int = 1,
cornerRadius: CGFloat? = nil,
textAlignment: UIStackView.Alignment = .center
textAlignment: UIStackView.Alignment = .center,
shadowOffset: CGSize = CGSize(width: 0, height: 4),
shadowColor: UIColor = .black.withAlphaComponent(0.08),
shadowOpacity: Float = 1
) {
self.minHeight = minHeight
self.minWidth = minWidth
Expand All @@ -40,5 +47,8 @@ public struct ToastViewConfiguration {
self.subtitleNumberOfLines = subtitleNumberOfLines
self.cornerRadius = cornerRadius
self.textAlignment = textAlignment
self.shadowOffset = shadowOffset
self.shadowColor = shadowColor
self.shadowOpacity = shadowOpacity
}
}
8 changes: 5 additions & 3 deletions Sources/Toast/ToastViews/AppleToastView/AppleToastView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ public class AppleToastView : UIView, ToastView {

private func addShadow() {
layer.masksToBounds = false
layer.shadowOffset = CGSize(width: 0, height: 4)
layer.shadowColor = UIColor.black.withAlphaComponent(0.08).cgColor
layer.shadowOpacity = 1

layer.shadowRadius = 8

layer.shadowOffset = config.shadowOffset
layer.shadowColor = config.shadowColor.cgColor
layer.shadowOpacity = config.shadowOpacity
}

required init?(coder: NSCoder) {
Expand Down