Skip to content

Commit

Permalink
Update ShareSheet.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuzukihashi committed Jul 15, 2024
1 parent f50220b commit 12e10f9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Sources/TsuzuKit/Utils/Share/ShareSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ import Foundation
import SwiftUI

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

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

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

var activityItems: [Any] = [text, itemSource]
if let image {
activityItems.append(image)
}
let controller = UIActivityViewController(
activityItems: activityItems,
applicationActivities: nil
Expand Down

0 comments on commit 12e10f9

Please sign in to comment.