Skip to content

Commit

Permalink
Merge pull request #36 from sanzaru/35-modifier-animation-on-dismiss-…
Browse files Browse the repository at this point in the history
…not-working-when-not-set-in-options

Fixed non working animation when toast disappears; better code structure
  • Loading branch information
sanzaru authored Oct 28, 2023
2 parents 251e0a9 + 595b483 commit 8dbc2e7
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 8dbc2e7

Please sign in to comment.