-
Notifications
You must be signed in to change notification settings - Fork 1
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
ae0f829
commit 5cd3d9e
Showing
5 changed files
with
57 additions
and
11 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
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,8 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Mercen on 2023/07/14. | ||
// | ||
|
||
import Foundation |
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 |
---|---|---|
@@ -1,12 +1,32 @@ | ||
import SwiftUI | ||
|
||
@available(macOS 11, iOS 14, *) | ||
struct TossButton: View { | ||
var body: some View { | ||
Button(action: { | ||
|
||
/** | ||
Animated Button of Toss. | ||
|
||
TossButton(action: { | ||
anyMethod() | ||
}) { | ||
|
||
Text("Button") | ||
.padding() | ||
} | ||
*/ | ||
@available(macOS 11, iOS 14, *) | ||
struct TossButton<Content: View>: View { | ||
|
||
let action: () -> () | ||
let content: Content | ||
|
||
/** | ||
- Parameters: | ||
- action: Action when the Button pressed. | ||
*/ | ||
public init(action: @escaping () -> (), | ||
@ViewBuilder content: @escaping () -> Content) { | ||
self.action = action | ||
self.content = content() | ||
} | ||
|
||
var body: some View { | ||
content | ||
} | ||
} |
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