diff --git a/Sources/PopupUI/PopupAnimation.swift b/Sources/PopupUI/PopupAnimation.swift index ba644d6..c45714e 100644 --- a/Sources/PopupUI/PopupAnimation.swift +++ b/Sources/PopupUI/PopupAnimation.swift @@ -11,7 +11,7 @@ public class PopupAnimation { public static var `default` = PopupAnimation(.center, .spring(response: 0.4, dampingFraction: 0.7, blendDuration: 0.35)) - public let position: PopupPosition + public var position: PopupPosition public var animation: Animation @@ -25,6 +25,20 @@ public class PopupAnimation { } +extension PopupAnimation { + @discardableResult + public func position(_ position: PopupPosition) -> PopupAnimation { + self.position = position + return self + } + + @discardableResult + public func animation(_ animation: Animation) -> PopupAnimation { + self.animation = animation + return self + } +} + extension Animation { var duration: TimeInterval { TimeInterval(description.components(separatedBy: ",").first(where: { $0.contains("duration") })?.components(separatedBy: "duration: ").last ??