-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix-580] Components: remove some animations
- Loading branch information
Showing
9 changed files
with
213 additions
and
61 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
core/Sources/Common/UIKit/Extension/Animation/UIView+ExecuteExtension.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// | ||
// UIView+ExecuteExtension.swift | ||
// SparkCore | ||
// | ||
// Created by robin.lemaire on 26/10/2023. | ||
// Copyright © 2023 Adevinta. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
extension UIView { | ||
|
||
/// Execute a code with or without animation. | ||
static func execute( | ||
isAnimated: Bool, | ||
withDuration duration: TimeInterval, | ||
context: @escaping () -> Void, | ||
completion: ((Bool) -> Void)? = nil | ||
) { | ||
if isAnimated { | ||
UIView.animate( | ||
withDuration: duration, | ||
animations: context, | ||
completion: completion) | ||
} else { | ||
context() | ||
completion?(true) | ||
} | ||
} | ||
|
||
/// Execute a code with or without transition animation. | ||
static func execute( | ||
with view: UIView, | ||
isTransitionAnimated: Bool, | ||
withDuration duration: TimeInterval, | ||
options: UIView.AnimationOptions = [], | ||
context: @escaping () -> Void, | ||
completion: ((Bool) -> Void)? = nil | ||
) { | ||
if isTransitionAnimated { | ||
UIView.transition( | ||
with: view, | ||
duration: duration, | ||
options: options, | ||
animations: context, | ||
completion: completion) | ||
} else { | ||
context() | ||
completion?(true) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.