From aef9a5ebf17f315f00017845154709374dedd433 Mon Sep 17 00:00:00 2001 From: fhasse95 <49185957+fhasse95@users.noreply.github.com> Date: Wed, 5 Aug 2026 22:44:26 +0200 Subject: [PATCH 1/2] Added Document Exporter Showcase --- Package.swift | 2 +- .../Showcase/DocumentPickerPlayground.swift | 45 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 271a4ae..51f6209 100644 --- a/Package.swift +++ b/Package.swift @@ -22,7 +22,7 @@ let package = Package( fuse ? .package(url: "https://source.skip.tools/skip-fuse-ui.git", from: "1.0.0") : .package(url: "https://source.skip.tools/skip-ui.git", from: "1.59.0"), .package(url: "https://source.skip.tools/skip.git", from: "1.9.4"), - .package(url: "https://source.skip.tools/skip-kit.git", from: "1.1.0"), + .package(url: "https://github.com/fhasse95/skip-kit.git", branch: "Document-Exporter"), .package(url: "https://source.skip.tools/skip-av.git", "0.7.1"..<"2.0.0"), .package(url: "https://source.skip.tools/skip-web.git", "0.11.2"..<"2.0.0"), .package(url: "https://source.skip.tools/skip-sql.git", "0.16.0"..<"2.0.0"), diff --git a/Sources/Showcase/DocumentPickerPlayground.swift b/Sources/Showcase/DocumentPickerPlayground.swift index a215473..1372bfb 100644 --- a/Sources/Showcase/DocumentPickerPlayground.swift +++ b/Sources/Showcase/DocumentPickerPlayground.swift @@ -8,6 +8,7 @@ struct DocumentPickerPlayground: View { @State var presentPreview = false @State var presentCamera = false @State var presentMediaPicker = false + @State var presentDocumentExporter = false @State var allowsMultipleSelection = true @@ -15,6 +16,7 @@ struct DocumentPickerPlayground: View { @State var selectedFilenames: [String] = [] @State var selectedFileMimeTypes: [String] = [] @State var selectedMediaURLs: [URL] = [] + @State var exportDocumentURL: URL? @State var resultItems: [ResultItem] = [] @State var resultItemHeights: [String: Double] = [:] @@ -79,6 +81,24 @@ struct DocumentPickerPlayground: View { ScrollView { VStack(alignment: .leading, spacing: 16) { VStack(alignment: .center, spacing: 8) { + Button { + if let url = photoExportURL() { + exportDocumentURL = url + presentDocumentExporter = true + } + } label: { + Text("Export Photo") + .frame(maxWidth: .infinity, alignment: .center) + } + .buttonStyle(.borderedProminent) + .withDocumentExporter( + isPresented: $presentDocumentExporter, + contentType: .png, + documentURL: exportDocumentURL + ) + + Divider() + Button { presentCamera = true } label: { @@ -229,6 +249,31 @@ struct DocumentPickerPlayground: View { .clipShape(RoundedRectangle(cornerRadius: 8)) } + private func photoExportURL() -> URL? { + guard let resourceURL = Bundle.module.url(forResource: "skip-logo", withExtension: "png") else { + return nil + } + + #if SKIP + guard let cacheDir = UIApplication.shared.androidActivity?.cacheDir else { + return nil + } + + let destinationFile = java.io.File(cacheDir, "skip-logo.png") + let destinationURL = URL(fileURLWithPath: destinationFile.absolutePath) + + do { + let data = try Data(contentsOf: resourceURL) + try data.write(to: destinationURL) + return destinationURL + } catch { + return nil + } + #else + return resourceURL + #endif + } + private func filename(at index: Int, fallback: String) -> String { guard selectedFilenames.indices.contains(index) else { return fallback From 900102b9a028d15ad0fb20e03ae56fa4df4c4de4 Mon Sep 17 00:00:00 2001 From: fhasse95 <49185957+fhasse95@users.noreply.github.com> Date: Wed, 5 Aug 2026 22:44:42 +0200 Subject: [PATCH 2/2] Update Localizable.xcstrings --- .../Showcase/Resources/Localizable.xcstrings | 49 +++++++++++-------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/Sources/Showcase/Resources/Localizable.xcstrings b/Sources/Showcase/Resources/Localizable.xcstrings index b35ab7c..2cfbcd9 100644 --- a/Sources/Showcase/Resources/Localizable.xcstrings +++ b/Sources/Showcase/Resources/Localizable.xcstrings @@ -1008,6 +1008,12 @@ }, "AsyncImage" : { + }, + "Audio" : { + "comment" : "Title of Audio playground" + }, + "AudioPlayground is Lite-only until ported to SkipAV" : { + }, "Authenticate" : { @@ -1023,12 +1029,6 @@ }, "Authentication" : { - }, - "Audio" : { - "comment" : "Title of Audio playground" - }, - "AudioPlayground is Lite-only until ported to SkipAV" : { - }, "Availability" : { @@ -1207,13 +1207,13 @@ "Calendars (%lld)" : { }, - "Cancel" : { + "Can Authenticate" : { }, - "Cancelled" : { + "Cancel" : { }, - "Can Authenticate" : { + "Cancelled" : { }, "Capsule" : { @@ -1485,6 +1485,9 @@ }, "Detail View" : { + }, + "Dictionary version: %lld" : { + }, "Difference" : { @@ -1700,6 +1703,9 @@ }, "Expanding container in scroll view" : { + }, + "Export Photo" : { + }, "F1" : { @@ -2687,10 +2693,10 @@ "Nil Enum" : { }, - "NO" : { + "No" : { }, - "No" : { + "NO" : { }, "No badge (count 0)" : { @@ -2708,10 +2714,10 @@ "No URL\n.frame(100, 100)" : { }, - "Normal" : { + "None" : { }, - "None" : { + "Normal" : { }, "Not authenticated" : { @@ -4339,6 +4345,9 @@ } } } + }, + "Replace dictionary" : { + }, "Repository item tap count: %lld" : { @@ -5405,9 +5414,6 @@ }, "Title Only" : { - }, - "Type" : { - }, "To:" : { @@ -5480,6 +5486,9 @@ }, "Two Buttons" : { + }, + "Type" : { + }, "UIImage Prepared Thumbnail" : { @@ -5489,15 +5498,15 @@ }, "Unavailable" : { - }, - "Unspecified Biometric" : { - }, "Underline" : { }, "UnevenRoundedRectangle" : { + }, + "Unspecified Biometric" : { + }, "Upcoming Events (%lld)" : { @@ -5923,4 +5932,4 @@ } }, "version" : "1.0" -} +} \ No newline at end of file