diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 985d3f105..75a8ad4a4 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1 @@ github: philprime -custom: "https://www.paypal.me/tprm8" diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index 4e0258712..000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,18 +0,0 @@ -# Number of days of inactivity before an issue becomes stale -daysUntilStale: 60 -# Number of days of inactivity before a stale issue is closed -daysUntilClose: 7 -# Issues with these labels will never be considered stale -exemptLabels: - - pinned - - security - - enhancement -# Label to use when marking an issue as stale -staleLabel: stale -# Comment to post when marking an issue as stale. Set to `false` to disable -markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. -# Comment to post when closing a stale issue. Set to `false` to disable -closeComment: false diff --git a/.gitignore b/.gitignore index 6a3a8a964..b28b0bee3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,8 @@ # Xcode -# Generated with make generate-example-spm -Example-SPM/Example-SPM.xcodeproj/ +# Generated with make generate-example +Example/Example.xcodeproj/ ## Build generated build/ diff --git a/.kodiak.toml b/.kodiak.toml deleted file mode 100644 index 4c670d718..000000000 --- a/.kodiak.toml +++ /dev/null @@ -1,23 +0,0 @@ -version = 1 - -[update] -autoupdate_label = "♻️ autoupdate" - -[approve] -auto_approve_usernames = ["dependabot"] - -[merge] -method = "squash" -automerge_label = "🚀 automerge" - -[merge.automerge_dependencies] -# only auto merge "minor" and "patch" version upgrades. -# do not automerge "major" version upgrades. -versions = ["minor", "patch"] -# automerge by upgrade version for pull requests authored by dependabot. -usernames = ["dependabot"] - -[merge.message] -title = "pull_request_title" -body = "pull_request_body" -include_coauthors = true diff --git a/.swiftlint.yml b/.swiftlint.yml index c3846797d..29ab11b2d 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -54,8 +54,7 @@ identifier_name: error: 2 warning: 2 included: - - Example* - - Shared* + - Example - Source - Tests line_length: 150 diff --git a/Example-SPM/Example-SPM.yml b/Example/Example.yml similarity index 90% rename from Example-SPM/Example-SPM.yml rename to Example/Example.yml index 4555b81cc..a71f3b171 100644 --- a/Example-SPM/Example-SPM.yml +++ b/Example/Example.yml @@ -1,4 +1,4 @@ -name: Example-SPM +name: Example options: bundleIdPrefix: com.techprimate.TPPDF deploymentTarget: @@ -8,7 +8,7 @@ options: watchOS: "9.0" visionOS: "1.0" fileGroups: - - Example-SPM.yml + - Example.yml configs: Debug: debug Release: release @@ -16,14 +16,12 @@ packages: TPPDF: path: .. targets: - Example-SPM: + Example: type: application platform: auto sources: - - path: Example - - path: ../Shared/Examples - - path: ../Shared/Util - - path: ../Shared/Data + - path: Sources + - path: Resources buildPhase: resources dependencies: - package: TPPDF @@ -61,10 +59,10 @@ targets: ENABLE_PREVIEWS: YES ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon schemes: - Example-SPM: + Example: build: targets: - Example-SPM: all + Example: all run: config: Debug profile: diff --git a/Example-SPM/Example/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from Example-SPM/Example/Assets.xcassets/AppIcon.appiconset/Contents.json rename to Example/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/Example-SPM/Example/Assets.xcassets/Contents.json b/Example/Resources/Assets.xcassets/Contents.json similarity index 100% rename from Example-SPM/Example/Assets.xcassets/Contents.json rename to Example/Resources/Assets.xcassets/Contents.json diff --git a/Shared/Data/Documents/sample-large.pdf b/Example/Resources/Documents/sample-large.pdf similarity index 100% rename from Shared/Data/Documents/sample-large.pdf rename to Example/Resources/Documents/sample-large.pdf diff --git a/Shared/Data/Documents/sample.pdf b/Example/Resources/Documents/sample.pdf similarity index 100% rename from Shared/Data/Documents/sample.pdf rename to Example/Resources/Documents/sample.pdf diff --git a/Shared/Data/Images/Icon.png b/Example/Resources/Images/Icon.png similarity index 100% rename from Shared/Data/Images/Icon.png rename to Example/Resources/Images/Icon.png diff --git a/Shared/Data/Images/Image-1.jpg b/Example/Resources/Images/Image-1.jpg similarity index 100% rename from Shared/Data/Images/Image-1.jpg rename to Example/Resources/Images/Image-1.jpg diff --git a/Shared/Data/Images/Image-2.jpg b/Example/Resources/Images/Image-2.jpg similarity index 100% rename from Shared/Data/Images/Image-2.jpg rename to Example/Resources/Images/Image-2.jpg diff --git a/Shared/Data/Images/Image-3.jpg b/Example/Resources/Images/Image-3.jpg similarity index 100% rename from Shared/Data/Images/Image-3.jpg rename to Example/Resources/Images/Image-3.jpg diff --git a/Shared/Data/Images/Image-4.jpg b/Example/Resources/Images/Image-4.jpg similarity index 100% rename from Shared/Data/Images/Image-4.jpg rename to Example/Resources/Images/Image-4.jpg diff --git a/Shared/Data/Images/Image.jpg b/Example/Resources/Images/Image.jpg similarity index 100% rename from Shared/Data/Images/Image.jpg rename to Example/Resources/Images/Image.jpg diff --git a/Shared/Data/Images/PortraitImage.jpg b/Example/Resources/Images/PortraitImage.jpg similarity index 100% rename from Shared/Data/Images/PortraitImage.jpg rename to Example/Resources/Images/PortraitImage.jpg diff --git a/Example-SPM/Example/Preview Content/Preview Assets.xcassets/Contents.json b/Example/Resources/Preview Content/Preview Assets.xcassets/Contents.json similarity index 100% rename from Example-SPM/Example/Preview Content/Preview Assets.xcassets/Contents.json rename to Example/Resources/Preview Content/Preview Assets.xcassets/Contents.json diff --git a/Example-SPM/Example/ExampleApp.swift b/Example/Sources/ExampleApp.swift similarity index 100% rename from Example-SPM/Example/ExampleApp.swift rename to Example/Sources/ExampleApp.swift diff --git a/Shared/Examples/DocumentSettingsExampleFactory.swift b/Example/Sources/Examples/DocumentSettingsExampleFactory.swift similarity index 100% rename from Shared/Examples/DocumentSettingsExampleFactory.swift rename to Example/Sources/Examples/DocumentSettingsExampleFactory.swift diff --git a/Shared/Examples/Examples.swift b/Example/Sources/Examples/Examples.swift similarity index 100% rename from Shared/Examples/Examples.swift rename to Example/Sources/Examples/Examples.swift diff --git a/Shared/Examples/ExperimentFactory.swift b/Example/Sources/Examples/ExperimentFactory.swift similarity index 100% rename from Shared/Examples/ExperimentFactory.swift rename to Example/Sources/Examples/ExperimentFactory.swift diff --git a/Shared/Examples/ExternalDocumentExampleFactory.swift b/Example/Sources/Examples/ExternalDocumentExampleFactory.swift similarity index 100% rename from Shared/Examples/ExternalDocumentExampleFactory.swift rename to Example/Sources/Examples/ExternalDocumentExampleFactory.swift diff --git a/Shared/Examples/GroupExampleFactory.swift b/Example/Sources/Examples/GroupExampleFactory.swift similarity index 100% rename from Shared/Examples/GroupExampleFactory.swift rename to Example/Sources/Examples/GroupExampleFactory.swift diff --git a/Shared/Examples/HeaderFooterExampleFactory.swift b/Example/Sources/Examples/HeaderFooterExampleFactory.swift similarity index 100% rename from Shared/Examples/HeaderFooterExampleFactory.swift rename to Example/Sources/Examples/HeaderFooterExampleFactory.swift diff --git a/Shared/Examples/ImageExampleFactory.swift b/Example/Sources/Examples/ImageExampleFactory.swift similarity index 100% rename from Shared/Examples/ImageExampleFactory.swift rename to Example/Sources/Examples/ImageExampleFactory.swift diff --git a/Shared/Examples/LineSeparatorExampleFactory.swift b/Example/Sources/Examples/LineSeparatorExampleFactory.swift similarity index 100% rename from Shared/Examples/LineSeparatorExampleFactory.swift rename to Example/Sources/Examples/LineSeparatorExampleFactory.swift diff --git a/Shared/Examples/ListExampleFactory.swift b/Example/Sources/Examples/ListExampleFactory.swift similarity index 100% rename from Shared/Examples/ListExampleFactory.swift rename to Example/Sources/Examples/ListExampleFactory.swift diff --git a/Shared/Examples/MetadataExampleFactory.swift b/Example/Sources/Examples/MetadataExampleFactory.swift similarity index 100% rename from Shared/Examples/MetadataExampleFactory.swift rename to Example/Sources/Examples/MetadataExampleFactory.swift diff --git a/Shared/Examples/MultiSectionExampleFactory.swift b/Example/Sources/Examples/MultiSectionExampleFactory.swift similarity index 100% rename from Shared/Examples/MultiSectionExampleFactory.swift rename to Example/Sources/Examples/MultiSectionExampleFactory.swift diff --git a/Shared/Examples/MultipleDocumentsExampleFactory.swift b/Example/Sources/Examples/MultipleDocumentsExampleFactory.swift similarity index 100% rename from Shared/Examples/MultipleDocumentsExampleFactory.swift rename to Example/Sources/Examples/MultipleDocumentsExampleFactory.swift diff --git a/Shared/Examples/ObjectAttributesExampleFactory.swift b/Example/Sources/Examples/ObjectAttributesExampleFactory.swift similarity index 100% rename from Shared/Examples/ObjectAttributesExampleFactory.swift rename to Example/Sources/Examples/ObjectAttributesExampleFactory.swift diff --git a/Shared/Examples/PaginationExampleFactory.swift b/Example/Sources/Examples/PaginationExampleFactory.swift similarity index 100% rename from Shared/Examples/PaginationExampleFactory.swift rename to Example/Sources/Examples/PaginationExampleFactory.swift diff --git a/Shared/Examples/TableExampleFactory.swift b/Example/Sources/Examples/TableExampleFactory.swift similarity index 100% rename from Shared/Examples/TableExampleFactory.swift rename to Example/Sources/Examples/TableExampleFactory.swift diff --git a/Shared/Examples/TableOfContentsExampleFactory.swift b/Example/Sources/Examples/TableOfContentsExampleFactory.swift similarity index 100% rename from Shared/Examples/TableOfContentsExampleFactory.swift rename to Example/Sources/Examples/TableOfContentsExampleFactory.swift diff --git a/Shared/Examples/TextExampleFactory.swift b/Example/Sources/Examples/TextExampleFactory.swift similarity index 100% rename from Shared/Examples/TextExampleFactory.swift rename to Example/Sources/Examples/TextExampleFactory.swift diff --git a/Shared/Examples/TextStylesExampleFactory.swift b/Example/Sources/Examples/TextStylesExampleFactory.swift similarity index 100% rename from Shared/Examples/TextStylesExampleFactory.swift rename to Example/Sources/Examples/TextStylesExampleFactory.swift diff --git a/Example-SPM/Example/UI/ContentView.swift b/Example/Sources/UI/ContentView.swift similarity index 100% rename from Example-SPM/Example/UI/ContentView.swift rename to Example/Sources/UI/ContentView.swift diff --git a/Example-SPM/Example/UI/DetailView.swift b/Example/Sources/UI/DetailView.swift similarity index 100% rename from Example-SPM/Example/UI/DetailView.swift rename to Example/Sources/UI/DetailView.swift diff --git a/Example-SPM/Example/UI/PDFView+SwiftUI.swift b/Example/Sources/UI/PDFView+SwiftUI.swift similarity index 100% rename from Example-SPM/Example/UI/PDFView+SwiftUI.swift rename to Example/Sources/UI/PDFView+SwiftUI.swift diff --git a/Shared/Util/ExampleFactory.swift b/Example/Sources/Util/ExampleFactory.swift similarity index 100% rename from Shared/Util/ExampleFactory.swift rename to Example/Sources/Util/ExampleFactory.swift diff --git a/Shared/Util/LoremIpsum.swift b/Example/Sources/Util/LoremIpsum.swift similarity index 100% rename from Shared/Util/LoremIpsum.swift rename to Example/Sources/Util/LoremIpsum.swift diff --git a/Shared/Util/TimeUtils.swift b/Example/Sources/Util/TimeUtils.swift similarity index 100% rename from Shared/Util/TimeUtils.swift rename to Example/Sources/Util/TimeUtils.swift diff --git a/Makefile b/Makefile index ac34c6a48..ea9c6f5e9 100644 --- a/Makefile +++ b/Makefile @@ -92,14 +92,14 @@ install-ci: # # Invokes all individual generate targets to ensure all example projects are up-to-date. .PHONY: generate -generate: generate-example-spm +generate: generate-example -## Generate the shared Swift Package Manager example project +## Generate the SwiftUI example project # -# Regenerates Example-SPM.xcodeproj from its XcodeGen specification. -.PHONY: generate-example-spm -generate-example-spm: - xcodegen generate --spec Example-SPM/Example-SPM.yml +# Regenerates Example.xcodeproj from its XcodeGen specification. +.PHONY: generate-example +generate-example: + xcodegen generate --spec Example/Example.yml # ============================================================================ # BUILDING @@ -190,76 +190,76 @@ build-xcframework: # EXAMPLES # ============================================================================ -## Build the Swift Package Manager example for macOS +## Build the SwiftUI example for macOS # -# Builds the shared example app without requiring signing credentials. -.PHONY: build-example-spm-macos -build-example-spm-macos: generate-example-spm +# Builds the SwiftUI example app without requiring signing credentials. +.PHONY: build-example-macos +build-example-macos: generate-example set -o pipefail && xcrun xcodebuild \ - -project Example-SPM/Example-SPM.xcodeproj \ - -scheme Example-SPM \ + -project Example/Example.xcodeproj \ + -scheme Example \ -destination 'platform=macOS' \ - -derivedDataPath build/Example-SPM \ + -derivedDataPath build/Example \ CODE_SIGNING_ALLOWED=NO build | xcbeautify --preserve-unbeautified -## Build the Swift Package Manager example for iOS Simulator +## Build the SwiftUI example for iOS Simulator # -# Builds the shared example app for any available iOS Simulator SDK. -.PHONY: build-example-spm-ios -build-example-spm-ios: generate-example-spm +# Builds the SwiftUI example app for any available iOS Simulator SDK. +.PHONY: build-example-ios +build-example-ios: generate-example set -o pipefail && xcrun xcodebuild \ - -project Example-SPM/Example-SPM.xcodeproj \ - -scheme Example-SPM \ + -project Example/Example.xcodeproj \ + -scheme Example \ -destination 'generic/platform=iOS Simulator' \ - -derivedDataPath build/Example-SPM \ + -derivedDataPath build/Example \ CODE_SIGNING_ALLOWED=NO build | xcbeautify --preserve-unbeautified -## Build the Swift Package Manager example for Mac Catalyst +## Build the SwiftUI example for Mac Catalyst # -# Builds the shared example app without requiring signing credentials. -.PHONY: build-example-spm-maccatalyst -build-example-spm-maccatalyst: generate-example-spm +# Builds the SwiftUI example app without requiring signing credentials. +.PHONY: build-example-maccatalyst +build-example-maccatalyst: generate-example set -o pipefail && xcrun xcodebuild \ - -project Example-SPM/Example-SPM.xcodeproj \ - -scheme Example-SPM \ + -project Example/Example.xcodeproj \ + -scheme Example \ -destination 'generic/platform=macOS,variant=Mac Catalyst' \ - -derivedDataPath build/Example-SPM-maccatalyst \ + -derivedDataPath build/Example-maccatalyst \ CODE_SIGNING_ALLOWED=NO build | xcbeautify --preserve-unbeautified -## Build the Swift Package Manager example for tvOS Simulator +## Build the SwiftUI example for tvOS Simulator # -# Builds the shared example app without requiring signing credentials. -.PHONY: build-example-spm-tvos -build-example-spm-tvos: generate-example-spm +# Builds the SwiftUI example app without requiring signing credentials. +.PHONY: build-example-tvos +build-example-tvos: generate-example set -o pipefail && xcrun xcodebuild \ - -project Example-SPM/Example-SPM.xcodeproj \ - -scheme Example-SPM \ + -project Example/Example.xcodeproj \ + -scheme Example \ -destination 'generic/platform=tvOS Simulator' \ - -derivedDataPath build/Example-SPM-tvos \ + -derivedDataPath build/Example-tvos \ CODE_SIGNING_ALLOWED=NO build | xcbeautify --preserve-unbeautified -## Build the Swift Package Manager example for watchOS Simulator +## Build the SwiftUI example for watchOS Simulator # -# Builds the shared example app without requiring signing credentials. -.PHONY: build-example-spm-watchos -build-example-spm-watchos: generate-example-spm +# Builds the SwiftUI example app without requiring signing credentials. +.PHONY: build-example-watchos +build-example-watchos: generate-example set -o pipefail && xcrun xcodebuild \ - -project Example-SPM/Example-SPM.xcodeproj \ - -scheme Example-SPM \ + -project Example/Example.xcodeproj \ + -scheme Example \ -destination 'generic/platform=watchOS Simulator' \ - -derivedDataPath build/Example-SPM-watchos \ + -derivedDataPath build/Example-watchos \ CODE_SIGNING_ALLOWED=NO build | xcbeautify --preserve-unbeautified -## Build the Swift Package Manager example for visionOS Simulator +## Build the SwiftUI example for visionOS Simulator # -# Builds the shared example app without requiring signing credentials. -.PHONY: build-example-spm-visionos -build-example-spm-visionos: generate-example-spm +# Builds the SwiftUI example app without requiring signing credentials. +.PHONY: build-example-visionos +build-example-visionos: generate-example set -o pipefail && xcrun xcodebuild \ - -project Example-SPM/Example-SPM.xcodeproj \ - -scheme Example-SPM \ + -project Example/Example.xcodeproj \ + -scheme Example \ -destination 'generic/platform=visionOS Simulator' \ - -derivedDataPath build/Example-SPM-visionos \ + -derivedDataPath build/Example-visionos \ CODE_SIGNING_ALLOWED=NO build | xcbeautify --preserve-unbeautified # ============================================================================ diff --git a/README.md b/README.md index f660d8a87..b68239b21 100644 --- a/README.md +++ b/README.md @@ -113,11 +113,11 @@ For everything else, please see [Communication](#communication) and [this messag Take a look at the [Getting Started Guide](https://github.com/techprimate/TPPDF/blob/main/Documentation/Usage.md#getting-started) or checkout the Examples (using of one of the following): - Clone the repository and install XcodeGen with `brew bundle`. -- Run `make generate-example-spm`, then open `Example-SPM/Example-SPM.xcodeproj`. -- Run the `Example-SPM` scheme on iOS 16+, macOS 12+, Mac Catalyst, tvOS 16+, visionOS 1+, or watchOS 9+. +- Run `make generate-example`, then open `Example/Example.xcodeproj`. +- Run the `Example` scheme on iOS 16+, macOS 12+, Mac Catalyst, tvOS 16+, visionOS 1+, or watchOS 9+. - iOS, macOS, Mac Catalyst, tvOS, and visionOS display generated PDFs. watchOS reports generation success or errors without a PDF viewer. -- Edit `Example-SPM/Example-SPM.yml` to change project configuration, then regenerate it. The generated Xcode project is not committed. -- Build from the command line with `make build-example-spm-`, where `` is `ios`, `macos`, `maccatalyst`, `tvos`, `watchos`, or `visionos`. +- Edit `Example/Example.yml` to change project configuration, then regenerate it. The generated Xcode project is not committed. +- Build from the command line with `make build-example-`, where `` is `ios`, `macos`, `maccatalyst`, `tvos`, `watchos`, or `visionos`. ## Apps using TPPDF diff --git a/Shared iOS/Assets/Base.lproj/LaunchScreen.xib b/Shared iOS/Assets/Base.lproj/LaunchScreen.xib deleted file mode 100644 index 23d35b975..000000000 --- a/Shared iOS/Assets/Base.lproj/LaunchScreen.xib +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Shared iOS/Assets/Base.lproj/Main.storyboard b/Shared iOS/Assets/Base.lproj/Main.storyboard deleted file mode 100644 index dcb411723..000000000 --- a/Shared iOS/Assets/Base.lproj/Main.storyboard +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Shared iOS/Assets/Images.xcassets/AppIcon.appiconset/Contents.json b/Shared iOS/Assets/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index d25ce2477..000000000 --- a/Shared iOS/Assets/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "images": [ - { - "idiom": "iphone", - "size": "20x20", - "scale": "2x" - }, - { - "idiom": "iphone", - "size": "20x20", - "scale": "3x" - }, - { - "idiom": "iphone", - "size": "29x29", - "scale": "2x" - }, - { - "idiom": "iphone", - "size": "29x29", - "scale": "3x" - }, - { - "idiom": "iphone", - "size": "40x40", - "scale": "2x" - }, - { - "idiom": "iphone", - "size": "40x40", - "scale": "3x" - }, - { - "idiom": "iphone", - "size": "60x60", - "scale": "2x" - }, - { - "idiom": "iphone", - "size": "60x60", - "scale": "3x" - }, - { - "idiom": "ios-marketing", - "size": "1024x1024", - "scale": "1x" - } - ], - "info": { - "version": 1, - "author": "xcode" - } -} diff --git a/Shared iOS/UI/AppDelegate.swift b/Shared iOS/UI/AppDelegate.swift deleted file mode 100644 index 162dc50e1..000000000 --- a/Shared iOS/UI/AppDelegate.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// AppDelegate.swift -// TPPDF -// -// Created by Philip Niedertscheider on 16.08.2016. -// Copyright © 2016-2026 techprimate GmbH. All rights reserved. -// - -import UIKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - var window: UIWindow? -} diff --git a/Shared iOS/UI/ExamplesListViewController.swift b/Shared iOS/UI/ExamplesListViewController.swift deleted file mode 100644 index 3f611fd61..000000000 --- a/Shared iOS/UI/ExamplesListViewController.swift +++ /dev/null @@ -1,50 +0,0 @@ -// -// ExamplesListViewController.swift -// TPPDF -// -// Created by Philip Niedertscheider on 18.12.2019. -// Copyright © 2016-2026 techprimate GmbH. All rights reserved. -// - -import Foundation -import UIKit - -class ExamplesListViewController: UITableViewController { - override func numberOfSections(in _: UITableView) -> Int { - Examples.factories.count - } - - override func tableView(_: UITableView, numberOfRowsInSection section: Int) -> Int { - Examples.factories[section].examples.count - } - - override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCell(withIdentifier: "example-cell", for: indexPath) - - let section = Examples.factories[indexPath.section].examples - let item = section[indexPath.row] - - cell.textLabel?.text = item.name - - return cell - } - - override func tableView(_: UITableView, titleForHeaderInSection section: Int) -> String? { - Examples.factories[section].header - } - - override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - tableView.deselectRow(at: indexPath, animated: true) - performSegue(withIdentifier: "show-example", sender: indexPath) - } - - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - if segue.identifier == "show-example", let dest = segue.destination as? ViewController, let index = sender as? IndexPath { - let section = Examples.factories[index.section].examples - let item = section[index.row] - - dest.exampleFactory = item.factory - dest.navigationItem.title = item.name - } - } -} diff --git a/Shared iOS/UI/ViewController.swift b/Shared iOS/UI/ViewController.swift deleted file mode 100644 index 88d3a95ee..000000000 --- a/Shared iOS/UI/ViewController.swift +++ /dev/null @@ -1,73 +0,0 @@ -// -// ViewController.swift -// TPPDF -// -// Created by Philip Niedertscheider on 08.11.2016. -// Copyright © 2016-2026 techprimate GmbH. All rights reserved. -// - -import TPPDF -import UIKit -import WebKit - -class ViewController: UIViewController { - @IBOutlet var webView: WKWebView! - @IBOutlet var progressView: UIProgressView! - - var progressObserver: NSObjectProtocol! - - var exampleFactory: ExampleFactory? - - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - generateExamplePDF() - } - - private var observer: NSObjectProtocol! - - func generateExamplePDF() { - /* ---- Execution Metrics ---- */ - var startTime = CFAbsoluteTimeGetCurrent() - /* ---- Execution Metrics ---- */ - - guard let documents = exampleFactory?.generateDocument() else { - return - } - - /* ---- Execution Metrics ---- */ - print("Preparation took: " + TimeUtils.stringFromTimeInterval(interval: CFAbsoluteTimeGetCurrent() - startTime)) - startTime = CFAbsoluteTimeGetCurrent() - /* ---- Execution Metrics ---- */ - - var generator: PDFGeneratorProtocol - if documents.count > 1 { - generator = PDFMultiDocumentGenerator(documents: documents) - } else { - generator = PDFGenerator(document: documents.first!) - } - generator.debug = exampleFactory is ExperimentFactory - - progressView.observedProgress = generator.progress - observer = generator.progress.observe(\.completedUnitCount) { progress, _ in - print(progress.localizedDescription ?? "") - } - DispatchQueue.global(qos: .background).async { - do { - let url = try generator.generateURL(filename: "Example.pdf") - print("Output URL:", url) - - /* ---- Execution Metrics ---- */ - print("Generation took: " + TimeUtils.stringFromTimeInterval(interval: CFAbsoluteTimeGetCurrent() - startTime)) - /* ---- Execution Metrics ---- */ - - DispatchQueue.main.async { - self.progressView.isHidden = true - // Load PDF into a webview from the temporary file - self.webView.load(URLRequest(url: url)) - } - } catch { - print("Error while generating PDF: " + error.localizedDescription) - } - } - } -} diff --git a/scripts/ensure-runtime-loaded.sh b/scripts/ensure-runtime-loaded.sh deleted file mode 100755 index eed1512dc..000000000 --- a/scripts/ensure-runtime-loaded.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/bash -set -euo pipefail - -# Parse named arguments -OS_VERSION="" -PLATFORM="" - -usage() { - echo "Usage: $0 --os-version --platform " - echo " OS version: Version to ensure is loaded (e.g., 26.1 for beta, 16.4 for older iOS)" - echo " Platform: Platform to ensure is loaded (e.g., iOS, tvOS, visionOS)" - echo " Example: $0 --os-version 26.1 --platform iOS" - echo " Example: $0 --os-version 16.4" - exit 1 -} - -while [[ $# -gt 0 ]]; do - case $1 in - --os-version) - OS_VERSION="$2" - shift 2 - ;; - --platform) - PLATFORM="$2" - shift 2 - ;; - *) - echo "Unknown argument: $1" - usage - ;; - esac -done - -if [ -z "$OS_VERSION" ]; then - echo "Error: --os-version argument is required" - usage -fi - -if [ -z "$PLATFORM" ]; then - echo "Error: --platform argument is required" - usage -fi - -check_runtime_loaded() { - echo "Checking if runtime $PLATFORM ($OS_VERSION) is loaded..." - RUNTIMES=$(xcrun simctl list runtimes -v) - - echo "Available runtimes:" - echo "$RUNTIMES" - - if echo "$RUNTIMES" | grep -qE "$PLATFORM $OS_VERSION" && ! echo "$RUNTIMES" | grep -qE "$PLATFORM $OS_VERSION.*unavailable" ; then - echo "Runtime $OS_VERSION is loaded" - exit 0 - fi - echo "Runtime $OS_VERSION is not loaded" -} - -reload_runtime() { - echo "Reloading runtime $PLATFORM ($OS_VERSION)..." - - echo "Unloading CoreSimulator services volumes" - for dir in /Library/Developer/CoreSimulator/Volumes/*; do - echo "Ejecting $dir" - sudo diskutil unmount force "$dir" || true - done - - echo "Killing CoreSimulator services to force reload..." - sudo launchctl kill -9 system/com.apple.CoreSimulator.simdiskimaged || true - sudo pkill -9 com.apple.CoreSimulator.CoreSimulatorService || true - - echo "Killed all CoreSimulator services" -} - -wait_for_runtime() { - echo "Wait for a runtime to be loaded" - count=0 - MAX_ATTEMPTS=60 # 300 seconds (5 minutes) timeout - while [ $count -lt $MAX_ATTEMPTS ]; do - check_runtime_loaded - echo "Waiting for runtime $OS_VERSION to be loaded... attempt $count" - count=$((count + 1)) - sleep 5 - done - echo "Exceeded maximum attempts ($MAX_ATTEMPTS) to check for runtime" -} - -check_runtime_loaded -reload_runtime -wait_for_runtime - -echo "Runtime $PLATFORM ($OS_VERSION) is not loaded after reload attempts" -exit 1