aboutsummaryrefslogtreecommitdiff
path: root/Demo/SwiftyCropDemo/ShapeButton.swift
diff options
context:
space:
mode:
authorBen <31181527+benedom@users.noreply.github.com>2024-01-26 15:33:41 +0100
committerGitHub <noreply@github.com>2024-01-26 15:33:41 +0100
commit74bf9219d718ee1b47a2cde7d235ac3f73992df9 (patch)
treebee70f28097261f833a52f47d15ce9bf82f918bf /Demo/SwiftyCropDemo/ShapeButton.swift
parentf8cfea0bf31c889d431678fea0f86e39e2819761 (diff)
parent9d895fbac4c7c653a883969ac3520f1847d299e8 (diff)
Merge pull request #3 from leoz/master
Add demo app
Diffstat (limited to 'Demo/SwiftyCropDemo/ShapeButton.swift')
-rw-r--r--Demo/SwiftyCropDemo/ShapeButton.swift32
1 files changed, 32 insertions, 0 deletions
diff --git a/Demo/SwiftyCropDemo/ShapeButton.swift b/Demo/SwiftyCropDemo/ShapeButton.swift
new file mode 100644
index 0000000..c7aae9f
--- /dev/null
+++ b/Demo/SwiftyCropDemo/ShapeButton.swift
@@ -0,0 +1,32 @@
+//
+// ShapeButton.swift
+// SwiftyCropDemo
+//
+// Created by Leonid Zolotarev on 1/24/24.
+//
+
+import SwiftUI
+import SwiftyCrop
+
+struct ShapeButton: View {
+ let title: String
+ let shape: MaskShape
+ @Binding var selection: MaskShape
+
+ var body: some View {
+ Button {
+ selection = shape
+ } label: {
+ LongText(title: title)
+ }
+ .foregroundColor(selection == shape ? .accentColor : .secondary)
+ }
+}
+
+#Preview {
+ ShapeButton(
+ title: "title",
+ shape: .circle,
+ selection: .constant(.circle)
+ )
+}