Skip to content

Commit c67ec93

Browse files
committed
style: applied Swift Format
1 parent 4c70238 commit c67ec93

9 files changed

Lines changed: 55 additions & 50 deletions

Package.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ let package = Package(
1515
.package(url: "https://github.com/techprimate/TPPDF", from: "2.4.1"),
1616
//dev .package(url: "https://github.com/Quick/Quick", from: "7.0.0"),
1717
//dev .package(url: "https://github.com/Quick/Nimble", from: "12.0.0")
18+
//dev .package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.50.4"),
1819
],
1920
targets: [
2021
.target(name: "TPPDFAsync", dependencies: [

Shared/ExampleDocument.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
import TPPDF
1010

1111
class ExampleDocument {
12-
1312
static func create() -> PDFDocument {
1413
let document = PDFDocument(format: .a4)
15-
for _ in 0...1_000 {
14+
for _ in 0 ... 1_000 {
1615
document.add(.contentCenter, text: "Hello Async World!")
1716
}
1817
return document

Sources/TPPDFAsync/PDFAsyncGenerator+Combine.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
import Combine
12
import Foundation
23
import TPPDF
3-
import Combine
44

55
public extension PDFAsyncGenerator {
6-
76
// MARK: - Combine Tasks
87

98
func generateAsyncTask(

Sources/TPPDFAsync/PDFAsyncGenerator+Dispatch.swift

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@ import Foundation
22
import TPPDF
33

44
public extension PDFAsyncGenerator {
5-
65
// MARK: - Closure Completion Handlers
76

8-
func generateAsync(to url: URL,
9-
info: PDFInfo? = nil,
10-
workQueue: DispatchQueue = .global(qos: .background),
11-
notifyQueue: DispatchQueue = .main,
12-
completion: @escaping (Error?) -> Void) {
7+
func generateAsync(
8+
to url: URL,
9+
info: PDFInfo? = nil,
10+
workQueue: DispatchQueue = .global(qos: .background),
11+
notifyQueue: DispatchQueue = .main,
12+
completion: @escaping (Error?) -> Void)
13+
{
1314
let dispatchGroup = DispatchGroup()
1415
var failureError: Error?
15-
workQueue.async { [ weak self ] in
16+
workQueue.async { [weak self] in
1617
guard let strongSelf = self else {
1718
return
1819
}
@@ -29,14 +30,16 @@ public extension PDFAsyncGenerator {
2930
}
3031
}
3132

32-
func generateDataAsync(info: PDFInfo? = nil,
33-
workQueue: DispatchQueue = .global(qos: .background),
34-
notifyQueue: DispatchQueue = .main,
35-
completion: @escaping (Data?, Error?) -> Void) {
33+
func generateDataAsync(
34+
info: PDFInfo? = nil,
35+
workQueue: DispatchQueue = .global(qos: .background),
36+
notifyQueue: DispatchQueue = .main,
37+
completion: @escaping (Data?, Error?) -> Void)
38+
{
3639
let dispatchGroup = DispatchGroup()
3740
var resultData: Data?
3841
var failureError: Error?
39-
workQueue.async { [ weak self ] in
42+
workQueue.async { [weak self] in
4043
guard let strongSelf = self else {
4144
return
4245
}
@@ -53,15 +56,17 @@ public extension PDFAsyncGenerator {
5356
}
5457
}
5558

56-
func generateURLAsync(filename: String,
57-
info: PDFInfo? = nil,
58-
workQueue: DispatchQueue = .global(qos: .background),
59-
notifyQueue: DispatchQueue = .main,
60-
completion: @escaping (URL?, Error?) -> Void) {
59+
func generateURLAsync(
60+
filename: String,
61+
info: PDFInfo? = nil,
62+
workQueue: DispatchQueue = .global(qos: .background),
63+
notifyQueue: DispatchQueue = .main,
64+
completion: @escaping (URL?, Error?) -> Void)
65+
{
6166
let dispatchGroup = DispatchGroup()
6267
var resultURL: URL?
6368
var failureError: Error?
64-
workQueue.async { [ weak self ] in
69+
workQueue.async { [weak self] in
6570
guard let strongSelf = self else {
6671
return
6772
}

Sources/TPPDFAsync/PDFAsyncGenerator.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1+
import Combine
12
import Foundation
23
import TPPDF
3-
import Combine
44

55
public class PDFAsyncGenerator {
6-
76
internal let generator: PDFGenerator
87

98
public init(document: PDFDocument) {
10-
self.generator = PDFGenerator(document: document)
9+
generator = PDFGenerator(document: document)
1110
}
1211

1312
public var debug: Bool {

Sources/TPPDFAsync/PDFAsyncMultiDocumentGenerator+Combine.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
import Combine
12
import Foundation
23
import TPPDF
3-
import Combine
44

55
public extension PDFAsyncMultiDocumentGenerator {
6-
76
// MARK: - Combine Tasks
87

98
func generateAsyncTask(to url: URL, info: PDFInfo? = nil) -> Future<Void, Error> {

Sources/TPPDFAsync/PDFAsyncMultiDocumentGenerator+Dispatch.swift

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@ import Foundation
22
import TPPDF
33

44
public extension PDFAsyncMultiDocumentGenerator {
5-
65
// MARK: - Closure Completion Handlers
76

8-
func generateAsync(to url: URL,
9-
info: PDFInfo? = nil,
10-
workQueue: DispatchQueue = .global(qos: .background),
11-
notifyQueue: DispatchQueue = .main,
12-
completion: @escaping (Error?) -> Void) {
7+
func generateAsync(
8+
to url: URL,
9+
info: PDFInfo? = nil,
10+
workQueue: DispatchQueue = .global(qos: .background),
11+
notifyQueue: DispatchQueue = .main,
12+
completion: @escaping (Error?) -> Void
13+
) {
1314
let dispatchGroup = DispatchGroup()
1415
var failureError: Error?
15-
workQueue.async { [ weak self ] in
16+
workQueue.async { [weak self] in
1617
guard let strongSelf = self else {
1718
return
1819
}
@@ -29,14 +30,16 @@ public extension PDFAsyncMultiDocumentGenerator {
2930
}
3031
}
3132

32-
func generateDataAsync(info: PDFInfo? = nil,
33-
workQueue: DispatchQueue = .global(qos: .background),
34-
notifyQueue: DispatchQueue = .main,
35-
completion: @escaping (Data?, Error?) -> Void) {
33+
func generateDataAsync(
34+
info: PDFInfo? = nil,
35+
workQueue: DispatchQueue = .global(qos: .background),
36+
notifyQueue: DispatchQueue = .main,
37+
completion: @escaping (Data?, Error?) -> Void
38+
) {
3639
let dispatchGroup = DispatchGroup()
3740
var resultData: Data?
3841
var failureError: Error?
39-
workQueue.async { [ weak self ] in
42+
workQueue.async { [weak self] in
4043
guard let strongSelf = self else {
4144
return
4245
}
@@ -53,15 +56,17 @@ public extension PDFAsyncMultiDocumentGenerator {
5356
}
5457
}
5558

56-
func generateURLAsync(filename: String,
57-
info: PDFInfo? = nil,
58-
workQueue: DispatchQueue = .global(qos: .background),
59-
notifyQueue: DispatchQueue = .main,
60-
completion: @escaping (URL?, Error?) -> Void) {
59+
func generateURLAsync(
60+
filename: String,
61+
info: PDFInfo? = nil,
62+
workQueue: DispatchQueue = .global(qos: .background),
63+
notifyQueue: DispatchQueue = .main,
64+
completion: @escaping (URL?, Error?) -> Void
65+
) {
6166
let dispatchGroup = DispatchGroup()
6267
var resultURL: URL?
6368
var failureError: Error?
64-
workQueue.async { [ weak self ] in
69+
workQueue.async { [weak self] in
6570
guard let strongSelf = self else {
6671
return
6772
}

Sources/TPPDFAsync/PDFAsyncMultiDocumentGenerator.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1+
import Combine
12
import Foundation
23
import TPPDF
3-
import Combine
44

55
public class PDFAsyncMultiDocumentGenerator {
6-
76
internal let generator: PDFMultiDocumentGenerator
87

98
public init(documents: [PDFDocument]) {
10-
self.generator = PDFMultiDocumentGenerator(documents: documents)
9+
generator = PDFMultiDocumentGenerator(documents: documents)
1110
}
1211

1312
public var debug: Bool {

Tests/TPPDFAsyncTests/TPPDFAsyncTest.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
// Copyright © 2020 techprimate GmbH & Co. KG. All rights reserved.
77
//
88

9-
import Quick
109
import Nimble
10+
import Quick
1111
@testable import TPPDFAsync
1212

1313
class TPPDFAsyncTest: QuickSpec {
14-
1514
override class func spec() {
1615
expect(true).to(beTruthy())
1716
}

0 commit comments

Comments
 (0)