// // 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() } }