From 2a08989f3201b2624dc67f1d5bea94d7703aebeb Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Sun, 10 Nov 2024 13:41:34 +0100 Subject: [PATCH 1/8] chore(dev): add debug configuration toggle for macOS examples --- Example macOS/Example/UI/DetailView.swift | 18 +++++++++++++----- .../project.pbxproj | 4 ++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Example macOS/Example/UI/DetailView.swift b/Example macOS/Example/UI/DetailView.swift index 62233c64..2e069646 100644 --- a/Example macOS/Example/UI/DetailView.swift +++ b/Example macOS/Example/UI/DetailView.swift @@ -18,14 +18,22 @@ struct DetailView: View { @State var observer: NSObjectProtocol! = nil @State var progressValue: Double = 0.5 + @State var debug = false + var body: some View { VStack(alignment: .leading, spacing: 0) { HStack { Text("\(example.name)") .font(.headline) + Toggle(isOn: $debug) { + Text("Debug Mode") + } + .onChange(of: debug) { debug in + self.generatePDF(force: true, debug: debug) + } Spacer() Button(action: { - self.generatePDF(force: true) + self.generatePDF(force: true, debug: debug) }, label: { Text("Refresh") }) @@ -36,12 +44,12 @@ struct DetailView: View { PDFKitRepresentedView(url: url) .onAppear { - self.generatePDF(force: false) + self.generatePDF(force: false, debug: debug) } } } - func generatePDF(force: Bool) { + func generatePDF(force: Bool, debug: Bool) { if url != nil && !force { return } @@ -51,7 +59,7 @@ struct DetailView: View { } else { generator = PDFMultiDocumentGenerator(documents: docs) } - generator.debug = true + generator.debug = debug observer = generator.progress.observe(\.completedUnitCount) { progress, _ in self.progressValue = progress.fractionCompleted @@ -59,7 +67,7 @@ struct DetailView: View { DispatchQueue.global(qos: .background).async { do { - let url = try self.generator.generateURL(filename: "output.pdf") + let url = try self.generator.generateURL(filename: "output-\(UUID().uuidString).pdf") DispatchQueue.main.async { self.url = url } diff --git a/Example macOS/Example_macOS-SPM.xcodeproj/project.pbxproj b/Example macOS/Example_macOS-SPM.xcodeproj/project.pbxproj index 25baea87..8c186287 100644 --- a/Example macOS/Example_macOS-SPM.xcodeproj/project.pbxproj +++ b/Example macOS/Example_macOS-SPM.xcodeproj/project.pbxproj @@ -527,7 +527,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.15; + MACOSX_DEPLOYMENT_TARGET = 11; PRODUCT_BUNDLE_IDENTIFIER = com.techprimate.TPPDF.Example; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -554,7 +554,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.15; + MACOSX_DEPLOYMENT_TARGET = 11; PRODUCT_BUNDLE_IDENTIFIER = com.techprimate.TPPDF.Example; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; From 7729d6fd01979c6b421eeaeeddd0ce269aea1463 Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Sun, 10 Nov 2024 13:42:14 +0100 Subject: [PATCH 2/8] chore: add annotation retroactive for NSEdgeInsets Equatable implementation --- Source/API/Utils/CrossPlattformGraphics.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/API/Utils/CrossPlattformGraphics.swift b/Source/API/Utils/CrossPlattformGraphics.swift index 2890614b..bd057ed9 100644 --- a/Source/API/Utils/CrossPlattformGraphics.swift +++ b/Source/API/Utils/CrossPlattformGraphics.swift @@ -66,7 +66,7 @@ } } - extension NSEdgeInsets: Equatable { +extension NSEdgeInsets: @retroactive Equatable { public static func == (lhs: NSEdgeInsets, rhs: NSEdgeInsets) -> Bool { lhs.top == rhs.top && lhs.left == rhs.left && lhs.bottom == rhs.bottom && lhs.right == rhs.right } From 717e7977ecd77c22c078cb2d2b13711715892dc4 Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Sun, 10 Nov 2024 14:21:51 +0100 Subject: [PATCH 3/8] chore(test): change runs-on for iphonesimulator test to macOS 15 --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e669108e..b395117d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,7 +24,7 @@ jobs: sdk: "iphonesimulator", destination: "platform=iOS Simulator,OS=18.0,name=iPhone 16 Pro", action: "test", - runs-on: "macos-14", + runs-on: "macos-15", }, { sdk: "xros", From 037963251ad6592fe07989fcb547ec0ec44f474c Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Sun, 10 Nov 2024 14:25:16 +0100 Subject: [PATCH 4/8] chore(test): replace simulator iOS 18.0 with simulator iOS 18.1 --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b395117d..f93c5a99 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,7 +22,7 @@ jobs: [ { sdk: "iphonesimulator", - destination: "platform=iOS Simulator,OS=18.0,name=iPhone 16 Pro", + destination: "platform=iOS Simulator,OS=18.1,name=iPhone 16 Pro", action: "test", runs-on: "macos-15", }, From fbbd3d8f2cfbf6c1632fc613e336dcaa21ce6b72 Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Sun, 10 Nov 2024 14:25:39 +0100 Subject: [PATCH 5/8] style: format project files --- Package.swift | 2 +- Source/API/Layout/PDFContainer.swift | 2 +- Source/API/Metadata/PDFInfo.swift | 2 +- Source/API/PDFGenerator+Generation.swift | 2 +- Source/API/Utils/CrossPlattformGraphics.swift | 2 +- .../External/PDFExternalPageObject.swift | 2 +- .../Graphics/PDFContextGraphics.swift | 2 +- Source/Internal/Group/PDFGroupObject.swift | 2 +- .../Layout/PDFColumnLayoutState.swift | 20 +++++++++---------- .../Internal/Section/PDFSectionObject.swift | 2 +- Source/Internal/Table/PDFTableObject.swift | 4 ++-- .../Text/PDFAttributedTextObject.swift | 2 +- Source/Internal/Utils/PDFSlicedObject.swift | 2 +- 13 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Package.swift b/Package.swift index cf0069b3..f1f1eccb 100644 --- a/Package.swift +++ b/Package.swift @@ -7,7 +7,7 @@ let package = Package( platforms: [ .iOS(.v9), .macOS(.v10_14), - .visionOS(.v1) + .visionOS(.v1), ], products: [ .library(name: "TPPDF", targets: ["TPPDF"]), diff --git a/Source/API/Layout/PDFContainer.swift b/Source/API/Layout/PDFContainer.swift index 15591b19..1b083d55 100644 --- a/Source/API/Layout/PDFContainer.swift +++ b/Source/API/Layout/PDFContainer.swift @@ -96,7 +96,7 @@ public enum PDFContainer: CaseIterable { [ .headerLeft, .headerCenter, .headerRight, .contentLeft, .contentCenter, .contentRight, - .footerLeft, .footerCenter, .footerRight + .footerLeft, .footerCenter, .footerRight, ] } } diff --git a/Source/API/Metadata/PDFInfo.swift b/Source/API/Metadata/PDFInfo.swift index 5f6fcf6b..184216a9 100644 --- a/Source/API/Metadata/PDFInfo.swift +++ b/Source/API/Metadata/PDFInfo.swift @@ -98,7 +98,7 @@ public class PDFInfo { kCGPDFContextSubject as String: subject, kCGPDFContextKeywords as String: keywords, kCGPDFContextAllowsPrinting as String: allowsPrinting, - kCGPDFContextAllowsCopying as String: allowsCopying + kCGPDFContextAllowsCopying as String: allowsCopying, ] var creator = Bundle.main.infoDictionary?["CFBundleName"] as? String ?? "TPPDF" diff --git a/Source/API/PDFGenerator+Generation.swift b/Source/API/PDFGenerator+Generation.swift index 74d2a585..4e4753ec 100644 --- a/Source/API/PDFGenerator+Generation.swift +++ b/Source/API/PDFGenerator+Generation.swift @@ -329,7 +329,7 @@ public extension PDFGenerator { layout.margin.top + layout.heights.maxHeaderHeight(), layout.margin.top + layout.heights.maxHeaderHeight() + document.layout.space.header, document.layout.height - layout.margin.bottom - layout.heights.maxFooterHeight(), - document.layout.height - layout.margin.bottom - layout.heights.maxFooterHeight() - document.layout.space.footer + document.layout.height - layout.margin.bottom - layout.heights.maxFooterHeight() - document.layout.space.footer, ] var lines: [PDFLineObject] = [] diff --git a/Source/API/Utils/CrossPlattformGraphics.swift b/Source/API/Utils/CrossPlattformGraphics.swift index bd057ed9..2cd219f3 100644 --- a/Source/API/Utils/CrossPlattformGraphics.swift +++ b/Source/API/Utils/CrossPlattformGraphics.swift @@ -66,7 +66,7 @@ } } -extension NSEdgeInsets: @retroactive Equatable { + extension NSEdgeInsets: @retroactive Equatable { public static func == (lhs: NSEdgeInsets, rhs: NSEdgeInsets) -> Bool { lhs.top == rhs.top && lhs.left == rhs.left && lhs.bottom == rhs.bottom && lhs.right == rhs.right } diff --git a/Source/Internal/External/PDFExternalPageObject.swift b/Source/Internal/External/PDFExternalPageObject.swift index 2e1e898a..84dd7cac 100644 --- a/Source/Internal/External/PDFExternalPageObject.swift +++ b/Source/Internal/External/PDFExternalPageObject.swift @@ -21,7 +21,7 @@ class PDFExternalPageObject: PDFRenderObject { override func calculate(generator _: PDFGenerator, container: PDFContainer) throws -> [PDFLocatedRenderObject] { frame = page.getBoxRect(.mediaBox) return [ - (container, self) + (container, self), ] } diff --git a/Source/Internal/Graphics/PDFContextGraphics.swift b/Source/Internal/Graphics/PDFContextGraphics.swift index 21d31ed2..aaf41b4a 100644 --- a/Source/Internal/Graphics/PDFContextGraphics.swift +++ b/Source/Internal/Graphics/PDFContextGraphics.swift @@ -64,7 +64,7 @@ enum PDFContextGraphics { var mediaBox = bounds let boxData = NSData(bytes: &mediaBox, length: MemoryLayout.size(ofValue: mediaBox)) let pageInfo = [ - kCGPDFContextMediaBox as String: boxData + kCGPDFContextMediaBox as String: boxData, ] context.beginPDFPage(pageInfo as CFDictionary) diff --git a/Source/Internal/Group/PDFGroupObject.swift b/Source/Internal/Group/PDFGroupObject.swift index 498f21ab..c4cec7d0 100644 --- a/Source/Internal/Group/PDFGroupObject.swift +++ b/Source/Internal/Group/PDFGroupObject.swift @@ -59,7 +59,7 @@ class PDFGroupObject: PDFRenderObject { } var groupedResult = [ - [PDFLocatedRenderObject]() + [PDFLocatedRenderObject](), ] // Set padding diff --git a/Source/Internal/Layout/PDFColumnLayoutState.swift b/Source/Internal/Layout/PDFColumnLayoutState.swift index 40878a8f..6d0bdaad 100644 --- a/Source/Internal/Layout/PDFColumnLayoutState.swift +++ b/Source/Internal/Layout/PDFColumnLayoutState.swift @@ -24,27 +24,27 @@ class PDFColumnLayoutState: CustomStringConvertible { self.currentColumn = [ .headerLeft: 0, .contentLeft: 0, - .footerLeft: 0 + .footerLeft: 0, ] self.columnWidths = [ .headerLeft: [], .contentLeft: [], - .footerLeft: [] + .footerLeft: [], ] self.columnSpacings = [ .headerLeft: [], .contentLeft: [], - .footerLeft: [] + .footerLeft: [], ] self.wrapColumnsHeight = [ .headerLeft: 0, .contentLeft: 0, - .footerLeft: 0 + .footerLeft: 0, ] self.inset = [ .headerLeft: (0, 0), .contentLeft: (0, 0), - .footerLeft: (0, 0) + .footerLeft: (0, 0), ] } @@ -53,27 +53,27 @@ class PDFColumnLayoutState: CustomStringConvertible { currentColumn = [ .headerLeft: 0, .contentLeft: 0, - .footerLeft: 0 + .footerLeft: 0, ] columnWidths = [ .headerLeft: [], .contentLeft: [], - .footerLeft: [] + .footerLeft: [], ] columnSpacings = [ .headerLeft: [], .contentLeft: [], - .footerLeft: [] + .footerLeft: [], ] wrapColumnsHeight = [ .headerLeft: 0, .contentLeft: 0, - .footerLeft: 0 + .footerLeft: 0, ] inset = [ .headerLeft: (0, 0), .contentLeft: (0, 0), - .footerLeft: (0, 0) + .footerLeft: (0, 0), ] } diff --git a/Source/Internal/Section/PDFSectionObject.swift b/Source/Internal/Section/PDFSectionObject.swift index 7a842b95..95d4fa92 100644 --- a/Source/Internal/Section/PDFSectionObject.swift +++ b/Source/Internal/Section/PDFSectionObject.swift @@ -122,7 +122,7 @@ class PDFSectionObject: PDFRenderObject { // stores how many objects are in one column at max let maxObjectsPerColumn = objectsPerColumn.reduce(0) { max($0, $1.value.count) } - /* + /* * as soon as a column requests a page break, we need to stack subsequent objects of the very same column until the following is `true`: * one or more columns do not have more objects and all other columns, which have more objects left, are requesting a page break */ diff --git a/Source/Internal/Table/PDFTableObject.swift b/Source/Internal/Table/PDFTableObject.swift index 5389e41f..c9628862 100644 --- a/Source/Internal/Table/PDFTableObject.swift +++ b/Source/Internal/Table/PDFTableObject.swift @@ -267,7 +267,7 @@ class PDFTableObject: PDFRenderObject { let attributes: [NSAttributedString.Key: AnyObject] = [ .foregroundColor: cellStyle.colors.text, .font: cellStyle.font, - .paragraphStyle: paragraph + .paragraphStyle: paragraph, ] return NSAttributedString(string: text, attributes: attributes) } @@ -615,7 +615,7 @@ class PDFTableObject: PDFRenderObject { endPoint: CGPoint(x: frame.maxX, y: frame.maxY)), PDFLineObject(style: borders.left, startPoint: CGPoint(x: frame.minX, y: frame.minY), - endPoint: CGPoint(x: frame.minX, y: frame.maxY)) + endPoint: CGPoint(x: frame.minX, y: frame.maxY)), ] } diff --git a/Source/Internal/Text/PDFAttributedTextObject.swift b/Source/Internal/Text/PDFAttributedTextObject.swift index 580c1cd8..a72cbefa 100644 --- a/Source/Internal/Text/PDFAttributedTextObject.swift +++ b/Source/Internal/Text/PDFAttributedTextObject.swift @@ -287,7 +287,7 @@ class PDFAttributedTextObject: PDFRenderObject { return [ NSAttributedString.Key.font: style?.font ?? fonts[container]!, NSAttributedString.Key.foregroundColor: style?.color ?? textColor[container]!, - NSAttributedString.Key.paragraphStyle: paragraphStyle + NSAttributedString.Key.paragraphStyle: paragraphStyle, ] } diff --git a/Source/Internal/Utils/PDFSlicedObject.swift b/Source/Internal/Utils/PDFSlicedObject.swift index cb21222d..185ab1e8 100644 --- a/Source/Internal/Utils/PDFSlicedObject.swift +++ b/Source/Internal/Utils/PDFSlicedObject.swift @@ -23,7 +23,7 @@ class PDFSlicedObject: PDFRenderObject { override func calculate(generator _: PDFGenerator, container: PDFContainer) throws -> [PDFLocatedRenderObject] { [ - (container, self) + (container, self), ] } From e5736423bcb74d8a4d7906bbf8749e81bdd3809f Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Sun, 10 Nov 2024 14:27:58 +0100 Subject: [PATCH 6/8] style: disable trailing comma rule in SwiftLint configuration --- .swiftlint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.swiftlint.yml b/.swiftlint.yml index a58c8f60..b7f06be5 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -3,6 +3,7 @@ disabled_rules: - large_tuple - todo - inclusive_language + - trailing_comma excluded: - Carthage - Pods From 3ab677f9d4587308fe08ec2eea1c65162d454e04 Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Sun, 10 Nov 2024 14:35:46 +0100 Subject: [PATCH 7/8] chore(ci): remove CHANGELOG check from Danger --- Dangerfile.swift | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Dangerfile.swift b/Dangerfile.swift index baf17580..c2c29b98 100644 --- a/Dangerfile.swift +++ b/Dangerfile.swift @@ -5,15 +5,7 @@ let danger = Danger() // Changelog entries are required for changes to library files. let allSourceFiles = danger.git.modifiedFiles + danger.git.createdFiles -let noChangelogEntry = !allSourceFiles.contains("CHANGELOG.md") let sourceChanges = allSourceFiles.contains { $0.hasPrefix("Source") } -let isNotTrivial = !danger.github.pullRequest.title.contains("#trivial") -if isNotTrivial && noChangelogEntry && sourceChanges { - danger.warn(""" - Any changes to library code should be reflected in the Changelog. - Please consider adding a note there. - """) -} // Make it more obvious that a PR is a work in progress and shouldn't be merged yet if danger.github.pullRequest.title.contains("WIP") || danger.github.pullRequest.title.contains("Draft") { From 838ff8ba2bacd57002d8d086c212cdcdb1e45723 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 10 Nov 2024 13:46:47 +0000 Subject: [PATCH 8/8] chore(deps): update dependency slather to v2.8.5 (#399) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [slather](https://redirect.github.com/SlatherOrg/slather) | `2.8.4` -> `2.8.5` | [![age](https://developer.mend.io/api/mc/badges/age/rubygems/slather/2.8.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/rubygems/slather/2.8.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/rubygems/slather/2.8.4/2.8.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/rubygems/slather/2.8.4/2.8.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
SlatherOrg/slather (slather) ### [`v2.8.5`](https://redirect.github.com/SlatherOrg/slather/blob/HEAD/CHANGELOG.md#v285) [Compare Source](https://redirect.github.com/SlatherOrg/slather/compare/v2.8.4...v2.8.5) - Update xcodeproj to 1.27.1 to support Xcode 16 folder references [authiatr](https://redirect.github.com/authiatr) [#​574](https://redirect.github.com/SlatherOrg/slather/pull/574)
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/techprimate/TPPDF). --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 11fabed8..f7ef3f05 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -113,12 +113,12 @@ GEM sassc (2.4.0) ffi (~> 1.9) securerandom (0.3.1) - slather (2.8.4) + slather (2.8.5) CFPropertyList (>= 2.2, < 4) activesupport clamp (~> 1.3) nokogiri (>= 1.14.3) - xcodeproj (~> 1.25) + xcodeproj (~> 1.27) sqlite3 (1.7.3) mini_portile2 (~> 2.8.0) typhoeus (1.4.1)