Skip to content

Commit

Permalink
Create ShareSheet.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuzukihashi committed Jul 15, 2024
1 parent 311542d commit ceaa8f6
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Sources/TsuzuKit/Utils/Share/ShareSheet.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import Foundation
import SwiftUI

public struct ShareSheet: UIViewControllerRepresentable {
let image: UIImage
let text: String

public init(photo: UIImage, text: String) {
self.image = photo
self.text = text
}

public func makeUIViewController(context: Context) -> UIActivityViewController {
let itemSource = ShareActivityItemSource(shareText: text, shareImage: image)
let activityItems: [Any] = [image, text, itemSource]

let controller = UIActivityViewController(
activityItems: activityItems,
applicationActivities: nil
)

return controller
}

public func updateUIViewController(_ vc: UIActivityViewController, context: Context) {
}
}

0 comments on commit ceaa8f6

Please sign in to comment.