Skip to content

Commit

Permalink
Fixed non working animation when toast disappears; better code structure
Browse files Browse the repository at this point in the history
  • Loading branch information
sanzaru committed Oct 28, 2023
1 parent 6637b95 commit 595b483
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions Sources/SimpleToast/SimpleToastOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,40 +41,43 @@ public struct SimpleToastOptions {
case fade, slide, scale, skew
}

@available(swift, deprecated: 0.5.1, renamed: "init(alignment:hideAfter:backdrop:animation:modifierType:dismissOnTap:)")
public init(
alignment: Alignment = .top,
hideAfter: TimeInterval? = nil,
showBackdrop: Bool? = true,
backdropColor: Color = Color.white.opacity(0.9),
animation: Animation? = nil,
backdrop: Color? = nil,
animation: Animation = .linear,
modifierType: ModifierType = .fade,
dismissOnTap: Bool? = true

) {
self.alignment = alignment
self.hideAfter = hideAfter
self.showBackdrop = showBackdrop
self.backdropColor = backdropColor
self.backdrop = backdrop
self.animation = animation
self.modifierType = modifierType
self.dismissOnTap = dismissOnTap

}
}

// MARK: - Deprecated
extension SimpleToastOptions {
@available(swift, deprecated: 0.5.1, renamed: "init(alignment:hideAfter:backdrop:animation:modifierType:dismissOnTap:)")
public init(
alignment: Alignment = .top,
hideAfter: TimeInterval? = nil,
backdrop: Color? = nil,
showBackdrop: Bool? = true,
backdropColor: Color = Color.white.opacity(0.9),
animation: Animation? = nil,
modifierType: ModifierType = .fade,
dismissOnTap: Bool? = true

) {
self.alignment = alignment
self.hideAfter = hideAfter
self.backdrop = backdrop
self.showBackdrop = showBackdrop
self.backdropColor = backdropColor
self.animation = animation
self.modifierType = modifierType
self.dismissOnTap = dismissOnTap

}
}

0 comments on commit 595b483

Please sign in to comment.