diff --git a/Source/API/Delegation/PDFGeneratorImageDelegate.swift b/Source/API/Delegation/PDFGeneratorImageDelegate.swift index b5ab8aa1..45322b49 100644 --- a/Source/API/Delegation/PDFGeneratorImageDelegate.swift +++ b/Source/API/Delegation/PDFGeneratorImageDelegate.swift @@ -13,6 +13,6 @@ public protocol PDFGeneratorImageDelegate: AnyObject { public extension PDFGeneratorImageDelegate { - func generator(willBeginDrawingImage image: PDFImage, with context: PDFContext, in frame: CGRect){} + func generator(willBeginDrawingImage image: PDFImage, with context: PDFContext, in frame: CGRect) {} } diff --git a/Source/API/PDFGenerator.swift b/Source/API/PDFGenerator.swift index f726a3d9..b250b7d9 100644 --- a/Source/API/PDFGenerator.swift +++ b/Source/API/PDFGenerator.swift @@ -62,7 +62,7 @@ public class PDFGenerator: PDFGeneratorProtocol, CustomStringConvertible { Relative value tracking progress */ public let progress = Progress.discreteProgress(totalUnitCount: 3) - + /// Object acts as a delegate during the generation process public var delegate: PDFGeneratorDelegate? diff --git a/Source/API/Page Format/PDFPageFormat+NameConstants.swift b/Source/API/Page Format/PDFPageFormat+NameConstants.swift index 0cc2e24b..9a8d8509 100644 --- a/Source/API/Page Format/PDFPageFormat+NameConstants.swift +++ b/Source/API/Page Format/PDFPageFormat+NameConstants.swift @@ -9,7 +9,7 @@ import AppKit Source for names: https://www.papersizes.org */ public extension PDFPageFormat { - + /** Returns the defined US names if this format is a US format. If it is not a US format, it will check other constants for correct name @@ -30,7 +30,7 @@ public extension PDFPageFormat { return name } } - + /** Returns the defined ANSI name if this format is a ANSI format. If it is not a ANSI format, it will check other constants for correct name @@ -51,7 +51,7 @@ public extension PDFPageFormat { return name } } - + /** Returns the defined A-Series name if this format is a A-Series format. If it is not a A-Series format, it will check other constants for correct name @@ -84,7 +84,7 @@ public extension PDFPageFormat { return name } } - + /** Returns the defined B-Series name if this format is a B-Series format. If it is not a B-Series format, it will check other constants for correct name @@ -117,7 +117,7 @@ public extension PDFPageFormat { return name } } - + /** Returns the defined C-Series name if this format is a C-Series format. If it is not a C-Series format, it will check other constants for correct name diff --git a/Source/API/Page Format/PDFPageFormat.swift b/Source/API/Page Format/PDFPageFormat.swift index 7907ca11..0aceeba0 100644 --- a/Source/API/Page Format/PDFPageFormat.swift +++ b/Source/API/Page Format/PDFPageFormat.swift @@ -107,7 +107,7 @@ public enum PDFPageFormat: String, CaseIterable { public var landscapeSize: CGSize { CGSize(width: size.height, height: size.width) } - + /** Name defined in constants */ diff --git a/Source/API/Text/PDFAttributedText.swift b/Source/API/Text/PDFAttributedText.swift index 646c30f8..234c8b5f 100644 --- a/Source/API/Text/PDFAttributedText.swift +++ b/Source/API/Text/PDFAttributedText.swift @@ -61,8 +61,8 @@ public class PDFAttributedText: PDFText { } // MARK: - Hashable - - public override func hash(into hasher: inout Hasher) { + + override public func hash(into hasher: inout Hasher) { hasher.combine(text) } } diff --git a/Source/API/Text/PDFSimpleText.swift b/Source/API/Text/PDFSimpleText.swift index accfee0c..1d3f4cfd 100644 --- a/Source/API/Text/PDFSimpleText.swift +++ b/Source/API/Text/PDFSimpleText.swift @@ -80,7 +80,7 @@ public class PDFSimpleText: PDFText { } // MARK: - Hashable - + override public func hash(into hasher: inout Hasher) { hasher.combine(text) hasher.combine(spacing) diff --git a/Source/API/Text/PDFText.swift b/Source/API/Text/PDFText.swift index 29dbc083..4ab1dee9 100644 --- a/Source/API/Text/PDFText.swift +++ b/Source/API/Text/PDFText.swift @@ -12,4 +12,3 @@ public class PDFText: PDFDocumentObject, CustomStringConvertible { fatalError() } } - diff --git a/Source/Internal/Table/PDFTableObject.swift b/Source/Internal/Table/PDFTableObject.swift index 67417fcd..d912c3d1 100644 --- a/Source/Internal/Table/PDFTableObject.swift +++ b/Source/Internal/Table/PDFTableObject.swift @@ -110,7 +110,7 @@ internal class PDFTableObject: PDFRenderObject { headerCells += cells[rowIdx] rowIdx += 1 } - + // Safety check to make sure we don't reference rows we don't have. // This handles the case where we have a header row, but no data rows. if rowIdx >= table.size.rows { @@ -291,7 +291,6 @@ internal class PDFTableObject: PDFRenderObject { var nextPageCells: [PDFTableCalculatedCell] = cells var pageEnd = CGPoint.null var headerShift = table.showHeadersOnEveryPage - repeat { var pageStart = CGPoint.null @@ -347,7 +346,7 @@ internal class PDFTableObject: PDFRenderObject { nextPageCells = shiftCellsBy(cells: nextPageCells, shiftValue: headerHeight) headerShift = false } - //add table padding around cells + // add table padding around cells nextPageCells = shiftCellsBy(cells: nextPageCells, shiftValue: table.margin) } @@ -468,22 +467,22 @@ internal class PDFTableObject: PDFRenderObject { } return result } - + internal typealias ShiftedCells = [PDFTableCalculatedCell] - + internal func shiftCellsBy(cells: [PDFTableCalculatedCell], shiftValue: CGFloat) -> ShiftedCells { var shiftedCells: [PDFTableCalculatedCell] = [] - + for cell in cells { var shiftedCell = cell - + shiftedCell.frames.cell.origin.y += shiftValue shiftedCell.frames.content.origin.y += shiftValue shiftedCells.append(shiftedCell) } return shiftedCells } - + internal func createSliceObject(frame: CGRect, elements: [PDFRenderObject], minOffset: CGFloat, maxOffset: CGFloat) -> PDFSlicedObject { let sliceObject = PDFSlicedObject(children: elements, frame: frame) if frame.maxY > maxOffset { diff --git a/Source/Internal/Text/PDFAttributedTextObject.swift b/Source/Internal/Text/PDFAttributedTextObject.swift index a05478e8..b6d8bf92 100644 --- a/Source/Internal/Text/PDFAttributedTextObject.swift +++ b/Source/Internal/Text/PDFAttributedTextObject.swift @@ -205,14 +205,14 @@ internal class PDFAttributedTextObject: PDFRenderObject { } let startOffset = CTLineGetOffsetForStringIndex(metric.line, intersection.location, nil) let endOffset = CTLineGetOffsetForStringIndex(metric.line, intersection.location + intersection.length, nil) - + let linkFrame = CGRect( x: self.frame.origin.x + startOffset, y: metric.bounds.origin.y, width: endOffset - startOffset, height: metric.bounds.height) attributes.append((attribute: .link(url: url), frame: linkFrame)) - + if debug { PDFGraphics.drawRect(in: context, rect: linkFrame, diff --git a/Source/Internal/Utils/PDFCalculations.swift b/Source/Internal/Utils/PDFCalculations.swift index aabafe06..6f4b4828 100644 --- a/Source/Internal/Utils/PDFCalculations.swift +++ b/Source/Internal/Utils/PDFCalculations.swift @@ -125,7 +125,6 @@ internal enum PDFCalculations { - generator.currentPadding.right } - /// Calculates the available height in a given `container` on the current page. /// If the container is a header or a footer container, it has no limits and therefore returns the full page layout height /// @@ -384,7 +383,7 @@ internal enum PDFCalculations { position: (origin: CGPoint, width: CGFloat), text: NSAttributedString, alignment: PDFTableCellAlignment) -> CGRect { - let textMaxHeight = CGFloat.greatestFiniteMagnitude //PDFCalculations.calculateAvailableFrameHeight(for: generator, in: container) + let textMaxHeight = CGFloat.greatestFiniteMagnitude // PDFCalculations.calculateAvailableFrameHeight(for: generator, in: container) let frame: CGRect = CGRect(x: position.origin.x, y: position.origin.y, width: position.width, height: textMaxHeight) let currentRange = CFRange(location: 0, length: 0) @@ -409,9 +408,9 @@ internal enum PDFCalculations { let imageSize = image.size var imageHeight = 0.0 var imageWidth = 0.0 - + // scale down only if the image's width is larger than the cell's width - + if imageSize.width > width { imageHeight = imageSize.height / imageSize.width * width imageWidth = width @@ -419,7 +418,7 @@ internal enum PDFCalculations { imageHeight = imageSize.height imageWidth = imageSize.width } - + return CGRect(x: origin.x, y: origin.y, width: imageWidth, height: imageHeight) }