Skip to content

Commit

Permalink
update api
Browse files Browse the repository at this point in the history
  • Loading branch information
wuxingchen committed Mar 22, 2024
1 parent af9bdc7 commit 155e1ab
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Sources/PopupUI/PopupAnimation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 ??
Expand Down

0 comments on commit 155e1ab

Please sign in to comment.