create all templates .... started to fill one out
This commit is contained in:
42
Shared/views/ShareButtonview.swift
Normal file
42
Shared/views/ShareButtonview.swift
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// ShareButtonview.swift
|
||||
// Feels (iOS)
|
||||
//
|
||||
// Created by Trey Tartt on 2/8/22.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ShareButtonview: View, Equatable {
|
||||
static func == (lhs: ShareButtonview, rhs: ShareButtonview) -> Bool {
|
||||
lhs.image == rhs.image
|
||||
}
|
||||
|
||||
@State private var showSheet = false
|
||||
@State var image: UIImage? {
|
||||
didSet {
|
||||
showSheet = true
|
||||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
Button(action: {
|
||||
showSheet = true
|
||||
}, label: {
|
||||
Image(systemName: "square.and.arrow.up")
|
||||
.foregroundColor(.black)
|
||||
})
|
||||
|
||||
if showSheet {
|
||||
if let image = image {
|
||||
ActivityViewController(activityItems: [image])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct ShareButtonview_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ShareButtonview()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user