From f959fbb09bed7a936afaca1e1504143cd6f63db2 Mon Sep 17 00:00:00 2001 From: Adrian Schoenig Date: Tue, 2 Apr 2024 10:48:06 +1100 Subject: [PATCH 1/9] Xcode and SPM --- .../xcshareddata/xcschemes/MiniMap.xcscheme | 2 +- Package.resolved | 8 ++++---- .../xcshareddata/xcschemes/TripKit-Package.xcscheme | 2 +- .../xcshareddata/xcschemes/TripKit-iOS.xcscheme | 2 +- .../xcshareddata/xcschemes/TripKit-macOS.xcscheme | 2 +- .../xcshareddata/xcschemes/TripKitInterApp-iOS.xcscheme | 2 +- .../xcshareddata/xcschemes/TripKitUI-iOS.xcscheme | 2 +- .../xcshareddata/xcschemes/TripKitUIExample.xcscheme | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Examples/MiniMap/MiniMap.xcodeproj/xcshareddata/xcschemes/MiniMap.xcscheme b/Examples/MiniMap/MiniMap.xcodeproj/xcshareddata/xcschemes/MiniMap.xcscheme index 4cf66bd43..3c56e620a 100644 --- a/Examples/MiniMap/MiniMap.xcodeproj/xcshareddata/xcschemes/MiniMap.xcscheme +++ b/Examples/MiniMap/MiniMap.xcodeproj/xcshareddata/xcschemes/MiniMap.xcscheme @@ -1,6 +1,6 @@ Date: Tue, 2 Apr 2024 10:58:41 +1100 Subject: [PATCH 2/9] Add TripKitInterApp to SPM --- Package.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Package.swift b/Package.swift index 8f1de29a4..3ddbc5e34 100644 --- a/Package.swift +++ b/Package.swift @@ -18,6 +18,9 @@ let package = Package( .library( name: "TripKitUI", targets: ["TripKitUI"]), + .library( + name: "TripKitInterApp", + targets: ["TripKitInterApp"]), ], dependencies: [ .package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "6.1.0")), @@ -42,6 +45,11 @@ let package = Package( ], exclude: ["Supporting Files/Info.plist", "vendor/RxCombine/LICENSE"] ), + .target( + name: "TripKitInterApp", + dependencies: [], + exclude: ["Supporting Files/Info.plist"] + ), .testTarget( name: "TripKitTests", dependencies: [ From 73af7eb1e809db62b59ffd09eb4cb9f5305b2b78 Mon Sep 17 00:00:00 2001 From: Adrian Schoenig Date: Tue, 2 Apr 2024 11:45:50 +1100 Subject: [PATCH 3/9] Fix issues when using TripKitUI via SPM - Remove `customModuleProvider="target"` from XIBs - Use `Bundle.tripKitUI` everywhere - `Bundle.tripKitUI` maps to `Bundle.module` when using via SPM --- Package.swift | 6 ++- Sources/TripKitUI/TripKitUIBundle.swift | 4 ++ .../controller/TKUIAlertViewController.swift | 2 +- .../TKUISectionedAlertViewController.swift | 2 +- Sources/TripKitUI/views/TKUIDepartureCell.xib | 12 ++--- .../views/TKUIHomeCustomizerCell.xib | 6 +-- .../TripKitUI/views/TKUIModePickerCell.xib | 6 +-- Sources/TripKitUI/views/TKUINearbyCell.swift | 2 +- Sources/TripKitUI/views/TKUINearbyCell.xib | 6 +-- Sources/TripKitUI/views/TKUITripBoyView.swift | 3 +- Sources/TripKitUI/views/TKUITripBoyView.xib | 6 +-- .../TripKitUI/views/alerts/TKUIAlertCell.xib | 32 ++++++------- .../views/alerts/TKUIEmptyAlertView.xib | 10 ++--- .../views/alerts/TKUIGroupedAlertCell.xib | 31 +++++++------ .../views/alerts/TKUILoadingAlertView.xib | 19 ++++---- .../alerts/TKUISectionedAlertTableHeader.xib | 6 +-- .../views/results/TKUIProgressCell.swift | 2 +- .../views/results/TKUIProgressCell.xib | 6 +-- .../results/TKUIResultsAccessoryView.swift | 3 +- .../results/TKUIResultsAccessoryView.xib | 6 +-- .../views/results/TKUIResultsTitleView.xib | 6 +-- .../TKUIRoutingQueryInputTitleView.xib | 8 ++-- .../results/TKUIRoutingSupportView.swift | 2 +- .../views/results/TKUIRoutingSupportView.xib | 16 +++---- .../views/results/TKUITripCell.swift | 2 +- .../TripKitUI/views/results/TKUITripCell.xib | 8 ++-- .../TKUISegmentDirectionCell.xib | 6 +-- .../TKUISegmentInstructionsView.xib | 14 +++--- .../segment cards/TKUISegmentTitleView.swift | 2 +- .../segment cards/TKUISegmentTitleView.xib | 20 ++++----- .../timetable/TKUIServiceHeaderMiniView.swift | 2 +- .../timetable/TKUIServiceHeaderMiniView.xib | 2 +- .../timetable/TKUIServiceHeaderView.swift | 2 +- .../views/timetable/TKUIServiceHeaderView.xib | 2 +- .../timetable/TKUIServiceNumberCell.swift | 4 +- .../views/timetable/TKUIServiceNumberCell.xib | 8 ++-- .../timetable/TKUIServiceTitleView.swift | 2 +- .../views/timetable/TKUIServiceTitleView.xib | 12 ++--- .../timetable/TKUIServiceVisitCell.swift | 2 +- .../views/timetable/TKUIServiceVisitCell.xib | 16 +++---- .../TKUITimetableAccessoryView.swift | 3 +- .../timetable/TKUITimetableAccessoryView.xib | 18 +++++--- .../trip overview/TKUIAttributionCell.swift | 2 +- .../trip overview/TKUIAttributionCell.xib | 12 ++--- .../trip overview/TKUINotificationView.swift | 6 +-- .../trip overview/TKUINotificationView.xib | 6 +-- .../TKUIPathFriendlinessView.xib | 45 ++++++++++--------- .../trip overview/TKUISegmentAlertCell.swift | 2 +- .../trip overview/TKUISegmentAlertCell.xib | 17 ++++--- .../TKUISegmentImpossibleCell.swift | 2 +- .../TKUISegmentImpossibleCell.xib | 8 ++-- .../trip overview/TKUISegmentMovingCell.swift | 2 +- .../trip overview/TKUISegmentMovingCell.xib | 8 ++-- .../TKUISegmentStationaryCell.swift | 2 +- .../TKUISegmentStationaryCell.xib | 6 +-- .../TKUISegmentStationaryDoubleCell.swift | 2 +- .../TKUISegmentStationaryDoubleCell.xib | 16 +++---- .../trip overview/TKUITripTitleView.swift | 2 +- .../views/trip overview/TKUITripTitleView.xib | 18 ++++---- 59 files changed, 249 insertions(+), 234 deletions(-) diff --git a/Package.swift b/Package.swift index 3ddbc5e34..13d7a1c9b 100644 --- a/Package.swift +++ b/Package.swift @@ -37,7 +37,7 @@ let package = Package( .target( name: "TripKitUI", dependencies: [ - .target(name: "TripKit"), + "TripKit", "Kingfisher", .product(name: "RxCocoa", package: "RxSwift"), "TGCardViewController", @@ -47,7 +47,9 @@ let package = Package( ), .target( name: "TripKitInterApp", - dependencies: [], + dependencies: [ + "TripKit", + ], exclude: ["Supporting Files/Info.plist"] ), .testTarget( diff --git a/Sources/TripKitUI/TripKitUIBundle.swift b/Sources/TripKitUI/TripKitUIBundle.swift index 16d83a1e7..2a909b1af 100644 --- a/Sources/TripKitUI/TripKitUIBundle.swift +++ b/Sources/TripKitUI/TripKitUIBundle.swift @@ -71,7 +71,11 @@ class TripKitUIBundle: NSObject { } fileprivate static func bundle() -> Bundle { +#if SWIFT_PACKAGE + return Bundle.module +#else return Bundle(for: self) +#endif } } diff --git a/Sources/TripKitUI/controller/TKUIAlertViewController.swift b/Sources/TripKitUI/controller/TKUIAlertViewController.swift index 547ab660d..7e9e8af90 100644 --- a/Sources/TripKitUI/controller/TKUIAlertViewController.swift +++ b/Sources/TripKitUI/controller/TKUIAlertViewController.swift @@ -103,7 +103,7 @@ public class TKUIAlertViewController: UITableViewController { tableView.rowHeight = UITableView.automaticDimension tableView.estimatedRowHeight = 150 - tableView.register(UINib(nibName: "TKUIAlertCell", bundle: Bundle(for: TKUIAlertCell.self)), forCellReuseIdentifier: "TKUIAlertCell") + tableView.register(UINib(nibName: "TKUIAlertCell", bundle: .tripKitUI), forCellReuseIdentifier: "TKUIAlertCell") tableView.backgroundColor = .tkBackgroundGrouped tableView.separatorStyle = .none } diff --git a/Sources/TripKitUI/controller/TKUISectionedAlertViewController.swift b/Sources/TripKitUI/controller/TKUISectionedAlertViewController.swift index 049c86df5..0037213b6 100644 --- a/Sources/TripKitUI/controller/TKUISectionedAlertViewController.swift +++ b/Sources/TripKitUI/controller/TKUISectionedAlertViewController.swift @@ -38,7 +38,7 @@ public class TKUISectionedAlertViewController: UIViewController { // MARK: - Constructor public static func newInstance(region: TKRegion) -> TKUISectionedAlertViewController { - let controller = TKUISectionedAlertViewController(nibName: "TKUISectionedAlertViewController", bundle: Bundle(for: self)) + let controller = TKUISectionedAlertViewController(nibName: "TKUISectionedAlertViewController", bundle: .tripKitUI) controller.region = region return controller } diff --git a/Sources/TripKitUI/views/TKUIDepartureCell.xib b/Sources/TripKitUI/views/TKUIDepartureCell.xib index f9dc4966a..c911ef13b 100644 --- a/Sources/TripKitUI/views/TKUIDepartureCell.xib +++ b/Sources/TripKitUI/views/TKUIDepartureCell.xib @@ -10,7 +10,7 @@ - + @@ -33,7 +33,7 @@ -