From 9d3453dde67238112940810f275fd89a2dd0e7f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Bru=CC=88ckner?= Date: Tue, 27 Sep 2022 22:37:17 -0700 Subject: [PATCH] Add support for Swift package manager --- .gitignore | 3 ++- BoardingPassKit.podspec | 2 +- BoardingPassKit.xcodeproj/project.pbxproj | 22 ++++++++++--------- Package.swift | 22 +++++++++++++++++++ {Source => Sources}/BoardingPassKit.h | 0 {Source => Sources}/Info.plist | 0 .../Models/BPKBaggageTagRange.swift | 2 ++ .../Models/BPKBoardingPass.swift | 2 ++ .../Models/BPKDocumentNumber.swift | 2 ++ .../Models/BPKFlightSegment.swift | 2 ++ {Source => Sources}/Parser/BPKError.swift | 2 ++ {Source => Sources}/Parser/BPKParser.swift | 2 ++ .../BaggageTagRangeExampleTests.swift | 0 .../BoardingPassExamplev3Tests.swift | 0 .../BoardingPassExamplev4Tests.swift | 0 .../BoardingPassExamplev5Tests.swift | 0 {Test => Tests}/Info.plist | 0 {Test => Tests}/RegressionTests.swift | 0 18 files changed, 49 insertions(+), 12 deletions(-) create mode 100644 Package.swift rename {Source => Sources}/BoardingPassKit.h (100%) rename {Source => Sources}/Info.plist (100%) rename {Source => Sources}/Models/BPKBaggageTagRange.swift (96%) rename {Source => Sources}/Models/BPKBoardingPass.swift (99%) rename {Source => Sources}/Models/BPKDocumentNumber.swift (98%) rename {Source => Sources}/Models/BPKFlightSegment.swift (99%) rename {Source => Sources}/Parser/BPKError.swift (94%) rename {Source => Sources}/Parser/BPKParser.swift (99%) rename {Test => Tests}/BaggageTagRangeExampleTests.swift (100%) rename {Test => Tests}/BoardingPassExamplev3Tests.swift (100%) rename {Test => Tests}/BoardingPassExamplev4Tests.swift (100%) rename {Test => Tests}/BoardingPassExamplev5Tests.swift (100%) rename {Test => Tests}/Info.plist (100%) rename {Test => Tests}/RegressionTests.swift (100%) diff --git a/.gitignore b/.gitignore index dcd3864..a4b864a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -/*.xcworkspace/ +/.build/ +*.xcworkspace/ diff --git a/BoardingPassKit.podspec b/BoardingPassKit.podspec index 782bc32..7187e6f 100644 --- a/BoardingPassKit.podspec +++ b/BoardingPassKit.podspec @@ -19,6 +19,6 @@ Pod::Spec.new do |s| s.swift_version = '4.2' s.source = { :git => "https://github.com/invliD/BoardingPassKit.git", :tag => "#{s.version}" } - s.source_files = "Source/**/*.swift" + s.source_files = "Sources/**/*.swift" s.requires_arc = true end diff --git a/BoardingPassKit.xcodeproj/project.pbxproj b/BoardingPassKit.xcodeproj/project.pbxproj index c159e49..db85291 100644 --- a/BoardingPassKit.xcodeproj/project.pbxproj +++ b/BoardingPassKit.xcodeproj/project.pbxproj @@ -35,6 +35,7 @@ /* Begin PBXFileReference section */ 2406548020E96A16007B3823 /* BPKDocumentNumber.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BPKDocumentNumber.swift; sourceTree = ""; }; 244E150521978FBC00113995 /* RegressionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegressionTests.swift; sourceTree = ""; }; + 2481F0F528E4133700890CC0 /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; 24AEAF892054D45A00311ED5 /* BoardingPassKit.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = BoardingPassKit.podspec; sourceTree = ""; }; 24AEAF8B205514F200311ED5 /* BoardingPassExamplev4Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoardingPassExamplev4Tests.swift; sourceTree = ""; }; 24AEAF8E205517F800311ED5 /* BoardingPassExamplev3Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoardingPassExamplev3Tests.swift; sourceTree = ""; }; @@ -75,8 +76,9 @@ isa = PBXGroup; children = ( 24AEAF892054D45A00311ED5 /* BoardingPassKit.podspec */, - 24B3F5081FF3E06F002E489B /* Source */, - 24B3F51D1FFE9075002E489B /* Test */, + 2481F0F528E4133700890CC0 /* Package.swift */, + 24B3F5081FF3E06F002E489B /* Sources */, + 24B3F51D1FFE9075002E489B /* Tests */, 24B3F5071FF3E06F002E489B /* Products */, ); sourceTree = ""; @@ -91,7 +93,7 @@ name = Products; sourceTree = ""; }; - 24B3F5081FF3E06F002E489B /* Source */ = { + 24B3F5081FF3E06F002E489B /* Sources */ = { isa = PBXGroup; children = ( 24B3F51A1FF7C48E002E489B /* Parser */, @@ -99,7 +101,7 @@ 24B3F5091FF3E06F002E489B /* BoardingPassKit.h */, 24B3F50A1FF3E06F002E489B /* Info.plist */, ); - path = Source; + path = Sources; sourceTree = ""; }; 24B3F5121FF3E218002E489B /* Models */ = { @@ -122,7 +124,7 @@ path = Parser; sourceTree = ""; }; - 24B3F51D1FFE9075002E489B /* Test */ = { + 24B3F51D1FFE9075002E489B /* Tests */ = { isa = PBXGroup; children = ( 24B3F5311FFFCAEB002E489B /* BaggageTagRangeExampleTests.swift */, @@ -132,7 +134,7 @@ 244E150521978FBC00113995 /* RegressionTests.swift */, 24B3F5271FFE90C0002E489B /* Info.plist */, ); - path = Test; + path = Tests; sourceTree = ""; }; /* End PBXGroup section */ @@ -407,7 +409,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.invlid.BoardingPassKit; @@ -431,7 +433,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.invlid.BoardingPassKit; @@ -448,7 +450,7 @@ buildSettings = { CODE_SIGN_STYLE = Manual; DEVELOPMENT_TEAM = F3N5B69H2L; - INFOPLIST_FILE = Test/Info.plist; + INFOPLIST_FILE = Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.invlid.BoardingPassKitTests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -463,7 +465,7 @@ buildSettings = { CODE_SIGN_STYLE = Manual; DEVELOPMENT_TEAM = F3N5B69H2L; - INFOPLIST_FILE = Test/Info.plist; + INFOPLIST_FILE = Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.invlid.BoardingPassKitTests; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..f3c626d --- /dev/null +++ b/Package.swift @@ -0,0 +1,22 @@ +// swift-tools-version: 5.7 +import PackageDescription + +let package = Package( + name: "BoardingPassKit", + products: [ + .library( + name: "BoardingPassKit", + targets: ["BoardingPassKit"]), + ], + dependencies: [], + targets: [ + .target( + name: "BoardingPassKit", + dependencies: [], + path: "Sources"), + .testTarget( + name: "BoardingPassKitTests", + dependencies: ["BoardingPassKit"], + path: "Tests"), + ] +) diff --git a/Source/BoardingPassKit.h b/Sources/BoardingPassKit.h similarity index 100% rename from Source/BoardingPassKit.h rename to Sources/BoardingPassKit.h diff --git a/Source/Info.plist b/Sources/Info.plist similarity index 100% rename from Source/Info.plist rename to Sources/Info.plist diff --git a/Source/Models/BPKBaggageTagRange.swift b/Sources/Models/BPKBaggageTagRange.swift similarity index 96% rename from Source/Models/BPKBaggageTagRange.swift rename to Sources/Models/BPKBaggageTagRange.swift index 44c8f82..84bc603 100644 --- a/Source/Models/BPKBaggageTagRange.swift +++ b/Sources/Models/BPKBaggageTagRange.swift @@ -1,3 +1,5 @@ +import Foundation + public class BPKBaggageTagRange { public var type: UInt32 public var airlineNumeric: UInt32 diff --git a/Source/Models/BPKBoardingPass.swift b/Sources/Models/BPKBoardingPass.swift similarity index 99% rename from Source/Models/BPKBoardingPass.swift rename to Sources/Models/BPKBoardingPass.swift index 360023b..417f475 100644 --- a/Source/Models/BPKBoardingPass.swift +++ b/Sources/Models/BPKBoardingPass.swift @@ -1,3 +1,5 @@ +import Foundation + public class BPKBoardingPass { public var baggageTagRanges: [BPKBaggageTagRange] = [] public var boardingPassIssueYear: UInt32? diff --git a/Source/Models/BPKDocumentNumber.swift b/Sources/Models/BPKDocumentNumber.swift similarity index 98% rename from Source/Models/BPKDocumentNumber.swift rename to Sources/Models/BPKDocumentNumber.swift index 33c5c67..2110326 100644 --- a/Source/Models/BPKDocumentNumber.swift +++ b/Sources/Models/BPKDocumentNumber.swift @@ -1,3 +1,5 @@ +import Foundation + public class BPKDocumentNumber { public static let numericFormatter: NumberFormatter = { let formatter = NumberFormatter() diff --git a/Source/Models/BPKFlightSegment.swift b/Sources/Models/BPKFlightSegment.swift similarity index 99% rename from Source/Models/BPKFlightSegment.swift rename to Sources/Models/BPKFlightSegment.swift index 4480ee7..34346d0 100644 --- a/Source/Models/BPKFlightSegment.swift +++ b/Sources/Models/BPKFlightSegment.swift @@ -1,3 +1,5 @@ +import Foundation + public class BPKFlightSegment { public var airlineData: Data? public var cabinCode: String diff --git a/Source/Parser/BPKError.swift b/Sources/Parser/BPKError.swift similarity index 94% rename from Source/Parser/BPKError.swift rename to Sources/Parser/BPKError.swift index 8532fa4..965ea86 100644 --- a/Source/Parser/BPKError.swift +++ b/Sources/Parser/BPKError.swift @@ -1,3 +1,5 @@ +import Foundation + public enum BPKError: Error { case cannotParseBool(String) case cannotParseNumber(String) diff --git a/Source/Parser/BPKParser.swift b/Sources/Parser/BPKParser.swift similarity index 99% rename from Source/Parser/BPKParser.swift rename to Sources/Parser/BPKParser.swift index ed2919c..326514e 100644 --- a/Source/Parser/BPKParser.swift +++ b/Sources/Parser/BPKParser.swift @@ -1,3 +1,5 @@ +import Foundation + class BPKParser { private var cursor = 0 private var data: Data diff --git a/Test/BaggageTagRangeExampleTests.swift b/Tests/BaggageTagRangeExampleTests.swift similarity index 100% rename from Test/BaggageTagRangeExampleTests.swift rename to Tests/BaggageTagRangeExampleTests.swift diff --git a/Test/BoardingPassExamplev3Tests.swift b/Tests/BoardingPassExamplev3Tests.swift similarity index 100% rename from Test/BoardingPassExamplev3Tests.swift rename to Tests/BoardingPassExamplev3Tests.swift diff --git a/Test/BoardingPassExamplev4Tests.swift b/Tests/BoardingPassExamplev4Tests.swift similarity index 100% rename from Test/BoardingPassExamplev4Tests.swift rename to Tests/BoardingPassExamplev4Tests.swift diff --git a/Test/BoardingPassExamplev5Tests.swift b/Tests/BoardingPassExamplev5Tests.swift similarity index 100% rename from Test/BoardingPassExamplev5Tests.swift rename to Tests/BoardingPassExamplev5Tests.swift diff --git a/Test/Info.plist b/Tests/Info.plist similarity index 100% rename from Test/Info.plist rename to Tests/Info.plist diff --git a/Test/RegressionTests.swift b/Tests/RegressionTests.swift similarity index 100% rename from Test/RegressionTests.swift rename to Tests/RegressionTests.swift