-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f69a043
commit 857efd0
Showing
4 changed files
with
83 additions
and
18 deletions.
There are no files selected for viewing
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,22 @@ | ||
// | ||
// Copyright © 2022 Alexander Romanov | ||
// ScaleButton.swift | ||
// | ||
|
||
import SwiftUI | ||
|
||
public struct ScaleButtonStyle: ButtonStyle { | ||
public init() {} | ||
|
||
public func makeBody(configuration: Self.Configuration) -> some View { | ||
configuration.label | ||
.scaleEffect(configuration.isPressed ? 0.96 : 1) | ||
.animation(.easeIn(duration: 0.2), value: configuration.isPressed) | ||
} | ||
} | ||
|
||
public extension ButtonStyle where Self == ScaleButtonStyle { | ||
static var scale: ScaleButtonStyle { | ||
ScaleButtonStyle() | ||
} | ||
} |
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