From 13583cdc27318a871023d6314520be9225b67462 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 22 Oct 2020 07:53:35 -0500 Subject: [PATCH 1/4] Added SPM support --- .../contents.xcworkspacedata | 7 ++++ .../Classes/Card Parts/CardPartBarView.swift | 5 +++ .../Card Parts/CardPartCenteredView.swift | 4 ++ .../CardPartCollectionViewCardPartsCell.swift | 4 ++ .../Card Parts/CardPartConfettiView.swift | 18 +++++++-- .../Card Parts/CardPartMultiSliderView.swift | 5 +++ .../Card Parts/CardPartOrientedView.swift | 4 ++ .../Card Parts/CardPartSeparatorView.swift | 5 +++ .../Card Parts/CardPartSliderView.swift | 5 +++ .../Card Parts/CardPartSpacerView.swift | 5 +++ .../Card Parts/CardPartSwitchView.swift | 4 ++ .../Card Parts/CardPartTextField.swift | 6 ++- .../Card Parts/CardPartTitleView.swift | 16 ++++++-- .../Card Parts/CardPartTriangleView.swift | 4 ++ .../CardPartVerticalSeparatorView.swift | 5 +++ .../CardPartTableViewCardPartsCell.swift | 4 ++ .../CardPartsFullScreenViewController.swift | 4 ++ CardParts/src/Classes/CardPartsTheme.swift | 4 ++ .../src/Classes/CardsViewController.swift | 12 +++++- .../Delegates/CardVisibilityDelegate.swift | 4 ++ CardParts/src/Extensions/Date.swift | 4 ++ .../src/Extensions/NSObjectProtocol.swift | 4 ++ CardParts/src/Extensions/UIButton.swift | 4 ++ CardParts/src/Extensions/UIColor.swift | 4 ++ CardParts/src/Extensions/UIFont.swift | 4 ++ CardParts/src/Extensions/UIView.swift | 4 ++ CardParts/src/Utilities/CardUtils.swift | 4 ++ Example/Tests/CardPartImageViewTests.swift | 22 ++++++++++- Package.resolved | 34 +++++++++++++++++ Package.swift | 38 +++++++++++++++++++ 30 files changed, 237 insertions(+), 10 deletions(-) create mode 100644 .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata create mode 100644 Package.resolved create mode 100644 Package.swift diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/CardParts/src/Classes/Card Parts/CardPartBarView.swift b/CardParts/src/Classes/Card Parts/CardPartBarView.swift index 8a0f882a..172d4c3e 100644 --- a/CardParts/src/Classes/Card Parts/CardPartBarView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartBarView.swift @@ -6,7 +6,12 @@ // Copyright © 2017 Mint.com. All rights reserved. // +#if SWIFT_PACKAGE +import UIKit +#else import Foundation +#endif + import RxSwift import RxCocoa diff --git a/CardParts/src/Classes/Card Parts/CardPartCenteredView.swift b/CardParts/src/Classes/Card Parts/CardPartCenteredView.swift index b14d7378..25e5eb5c 100644 --- a/CardParts/src/Classes/Card Parts/CardPartCenteredView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartCenteredView.swift @@ -5,7 +5,11 @@ // Created by Tumer, Deniz on 6/20/18. // +#if SWIFT_PACKAGE +import UIKit +#else import Foundation +#endif public class CardPartCenteredView: UIView, CardPartView { public var margins: UIEdgeInsets = CardParts.theme.cardPartMargins diff --git a/CardParts/src/Classes/Card Parts/CardPartCollectionViewCardPartsCell.swift b/CardParts/src/Classes/Card Parts/CardPartCollectionViewCardPartsCell.swift index 0ff0b0c5..1c5d5d6c 100644 --- a/CardParts/src/Classes/Card Parts/CardPartCollectionViewCardPartsCell.swift +++ b/CardParts/src/Classes/Card Parts/CardPartCollectionViewCardPartsCell.swift @@ -5,7 +5,11 @@ // Created by Roossin, Chase on 3/7/18. // +#if SWIFT_PACKAGE +import UIKit +#else import Foundation +#endif open class CardPartCollectionViewCardPartsCell : UICollectionViewCell { diff --git a/CardParts/src/Classes/Card Parts/CardPartConfettiView.swift b/CardParts/src/Classes/Card Parts/CardPartConfettiView.swift index b17d9853..70af5c00 100644 --- a/CardParts/src/Classes/Card Parts/CardPartConfettiView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartConfettiView.swift @@ -37,7 +37,7 @@ public class CardPartConfettiView: UIView, CardPartView { } } - public var confettiImages = [UIImage(named: "confetti", in: Bundle(for: CardPartConfettiView.self),compatibleWith: nil)] as? [UIImage] + public var confettiImages = [UIImage(named: "confetti", in: Bundle.confetti,compatibleWith: nil)] as? [UIImage] //A layer that emits, animates, and renders a particle system. var emitter: CAEmitterLayer = CAEmitterLayer() @@ -127,15 +127,25 @@ public class CardPartConfettiView: UIView, CardPartView { private func image(for type: ConfettiType, index: Int = 0) -> UIImage? { switch type { case .diamond: - return UIImage(named: "diamond", in: Bundle(for: CardPartConfettiView.self), compatibleWith: nil) + return UIImage(named: "diamond", in: Bundle.confetti, compatibleWith: nil) case .star: - return UIImage(named: "star", in: Bundle(for: CardPartConfettiView.self), compatibleWith: nil) + return UIImage(named: "star", in: Bundle.confetti, compatibleWith: nil) case let .image(customImage): return customImage case .mixed: return confettiImages?[index] case .confetti: - return UIImage(named: "confetti", in: Bundle(for: CardPartConfettiView.self), compatibleWith: nil) + return UIImage(named: "confetti", in: Bundle.confetti, compatibleWith: nil) } } } + +private extension Bundle { + static var confetti: Bundle { + #if SWIFT_PACKAGE + return Bundle.module + #else + return Bundle(for: CardPartConfettiView.self) + #endif + } +} diff --git a/CardParts/src/Classes/Card Parts/CardPartMultiSliderView.swift b/CardParts/src/Classes/Card Parts/CardPartMultiSliderView.swift index d46437ac..baba826e 100644 --- a/CardParts/src/Classes/Card Parts/CardPartMultiSliderView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartMultiSliderView.swift @@ -5,7 +5,12 @@ // Created by bcarreon1 on 1/30/20. // +#if SWIFT_PACKAGE +import UIKit +#else import Foundation +#endif + import RxSwift import RxCocoa diff --git a/CardParts/src/Classes/Card Parts/CardPartOrientedView.swift b/CardParts/src/Classes/Card Parts/CardPartOrientedView.swift index d8f9a739..b97a3d5b 100644 --- a/CardParts/src/Classes/Card Parts/CardPartOrientedView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartOrientedView.swift @@ -5,7 +5,11 @@ // Created by Tumer, Deniz on 6/13/18. // +#if SWIFT_PACKAGE +import UIKit +#else import Foundation +#endif public enum Orientation { case top diff --git a/CardParts/src/Classes/Card Parts/CardPartSeparatorView.swift b/CardParts/src/Classes/Card Parts/CardPartSeparatorView.swift index c762167a..fe00b72f 100644 --- a/CardParts/src/Classes/Card Parts/CardPartSeparatorView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartSeparatorView.swift @@ -6,7 +6,12 @@ // Copyright © 2017 Mint.com. All rights reserved. // +#if SWIFT_PACKAGE +import UIKit +#else import Foundation +#endif + import RxSwift import RxCocoa diff --git a/CardParts/src/Classes/Card Parts/CardPartSliderView.swift b/CardParts/src/Classes/Card Parts/CardPartSliderView.swift index f6d3a4cf..507dea7a 100644 --- a/CardParts/src/Classes/Card Parts/CardPartSliderView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartSliderView.swift @@ -5,7 +5,12 @@ // Created by Kier, Tom on 12/9/17. // +#if SWIFT_PACKAGE +import UIKit +#else import Foundation +#endif + import RxSwift import RxCocoa diff --git a/CardParts/src/Classes/Card Parts/CardPartSpacerView.swift b/CardParts/src/Classes/Card Parts/CardPartSpacerView.swift index 2640d486..46dc7e90 100644 --- a/CardParts/src/Classes/Card Parts/CardPartSpacerView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartSpacerView.swift @@ -6,7 +6,12 @@ // Copyright © 2017 Mint.com. All rights reserved. // +#if SWIFT_PACKAGE +import UIKit +#else import Foundation +#endif + import RxSwift import RxCocoa diff --git a/CardParts/src/Classes/Card Parts/CardPartSwitchView.swift b/CardParts/src/Classes/Card Parts/CardPartSwitchView.swift index a5f070cc..50e07799 100644 --- a/CardParts/src/Classes/Card Parts/CardPartSwitchView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartSwitchView.swift @@ -5,6 +5,10 @@ // Created by bcarreon1 on 2/25/20. // +#if SWIFT_PACKAGE +import UIKit +#endif + public class CardPartSwitchView: UISwitch, CardPartView { public var margins: UIEdgeInsets = CardParts.theme.cardPartMargins } diff --git a/CardParts/src/Classes/Card Parts/CardPartTextField.swift b/CardParts/src/Classes/Card Parts/CardPartTextField.swift index 451f3e01..abc8b6da 100644 --- a/CardParts/src/Classes/Card Parts/CardPartTextField.swift +++ b/CardParts/src/Classes/Card Parts/CardPartTextField.swift @@ -5,8 +5,12 @@ // Created by Kier, Tom on 12/14/17. // +#if SWIFT_PACKAGE +import UIKit +#else import Foundation -import Foundation +#endif + import RxSwift import RxCocoa diff --git a/CardParts/src/Classes/Card Parts/CardPartTitleView.swift b/CardParts/src/Classes/Card Parts/CardPartTitleView.swift index b1a69c62..2dac88b8 100644 --- a/CardParts/src/Classes/Card Parts/CardPartTitleView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartTitleView.swift @@ -47,7 +47,7 @@ public class CardPartTitleView : UIView, CardPartView { public var menuButtonImageName: String = "arrowdown" { didSet { if type == .titleWithMenu || type == .titleWithActionableButton { - menuButtonImage = UIImage(named: menuButtonImageName, in: Bundle(for: CardPartTitleView.self), compatibleWith: nil) + menuButtonImage = UIImage(named: menuButtonImageName, in: Bundle.title, compatibleWith: nil) } } } @@ -80,7 +80,7 @@ public class CardPartTitleView : UIView, CardPartView { if let image = menuButtonImage { button.setImage(image, for: .normal) } else { - button.setImage(UIImage(named: menuButtonImageName, in: Bundle(for: CardPartTitleView.self), compatibleWith: nil), for: .normal) + button.setImage(UIImage(named: menuButtonImageName, in: Bundle.title, compatibleWith: nil), for: .normal) } button.addTarget(self, action: #selector(menuButtonTapped), for: UIControl.Event.touchUpInside) addSubview(button) @@ -92,7 +92,7 @@ public class CardPartTitleView : UIView, CardPartView { if let image = menuButtonImage { button.setImage(image, for: .normal) } else { - button.setImage(UIImage(named: menuButtonImageName, in: Bundle(for: CardPartTitleView.self), compatibleWith: nil), for: .normal) + button.setImage(UIImage(named: menuButtonImageName, in: Bundle.title, compatibleWith: nil), for: .normal) } button.addTarget(self, action: #selector(actionableMenuTapped), for: UIControl.Event.touchUpInside) addSubview(button) @@ -203,3 +203,13 @@ extension Reactive where Base: CardPartTitleView { } } } + +private extension Bundle { + static var title: Bundle { + #if SWIFT_PACKAGE + return Bundle.module + #else + return Bundle(for: CardPartTitleView.self) + #endif + } +} diff --git a/CardParts/src/Classes/Card Parts/CardPartTriangleView.swift b/CardParts/src/Classes/Card Parts/CardPartTriangleView.swift index 08ef96d7..240aa349 100644 --- a/CardParts/src/Classes/Card Parts/CardPartTriangleView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartTriangleView.swift @@ -5,7 +5,11 @@ // Created by Venkatnarayansetty, Badarinath on 9/19/19. // +#if SWIFT_PACKAGE +import UIKit +#else import Foundation +#endif class CardPartTriangleView: UIView,CardPartView { diff --git a/CardParts/src/Classes/Card Parts/CardPartVerticalSeparatorView.swift b/CardParts/src/Classes/Card Parts/CardPartVerticalSeparatorView.swift index 554d9952..0f3e3b22 100644 --- a/CardParts/src/Classes/Card Parts/CardPartVerticalSeparatorView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartVerticalSeparatorView.swift @@ -6,7 +6,12 @@ // Copyright © 2017 Mint.com. All rights reserved. // +#if SWIFT_PACKAGE +import UIKit +#else import Foundation +#endif + import RxSwift import RxCocoa diff --git a/CardParts/src/Classes/CardPartTableViewCardPartsCell.swift b/CardParts/src/Classes/CardPartTableViewCardPartsCell.swift index c59e07e4..59dff91d 100644 --- a/CardParts/src/Classes/CardPartTableViewCardPartsCell.swift +++ b/CardParts/src/Classes/CardPartTableViewCardPartsCell.swift @@ -6,7 +6,11 @@ // Copyright © 2017 Mint.com. All rights reserved. // +#if SWIFT_PACKAGE +import UIKit +#else import Foundation +#endif open class CardPartTableViewCardPartsCell : UITableViewCell { diff --git a/CardParts/src/Classes/CardPartsFullScreenViewController.swift b/CardParts/src/Classes/CardPartsFullScreenViewController.swift index 48c88cf0..611e496c 100644 --- a/CardParts/src/Classes/CardPartsFullScreenViewController.swift +++ b/CardParts/src/Classes/CardPartsFullScreenViewController.swift @@ -6,7 +6,11 @@ // Copyright © 2017 Mint.com. All rights reserved. // +#if SWIFT_PACKAGE +import UIKit +#else import Foundation +#endif open class CardPartsFullScreenViewController: CardPartsViewController { diff --git a/CardParts/src/Classes/CardPartsTheme.swift b/CardParts/src/Classes/CardPartsTheme.swift index 7585bf95..2fd477b8 100644 --- a/CardParts/src/Classes/CardPartsTheme.swift +++ b/CardParts/src/Classes/CardPartsTheme.swift @@ -5,7 +5,11 @@ // Created by Kier, Tom on 12/7/17. // +#if SWIFT_PACKAGE +import UIKit +#else import Foundation +#endif public protocol CardPartsTheme { diff --git a/CardParts/src/Classes/CardsViewController.swift b/CardParts/src/Classes/CardsViewController.swift index 3d8888e8..1e8c04af 100644 --- a/CardParts/src/Classes/CardsViewController.swift +++ b/CardParts/src/Classes/CardsViewController.swift @@ -248,7 +248,7 @@ open class CardsViewController : UIViewController, UICollectionViewDataSource, U }.disposed(by: bag) if getEditModeForIndexPath(indexPath: indexPath) { let editButton = UIButton(frame: CGRect(x: view.bounds.size.width - editButtonOffset - editButtonWidth, y: 0, width: editButtonWidth, height: editButtonHeight)) - editButton.setImage(UIImage(named: editButtonImage, in: Bundle(for: CardsViewController.self), compatibleWith: nil), for: .normal) + editButton.setImage(UIImage(named: editButtonImage, in: Bundle.controller, compatibleWith: nil), for: .normal) editButton.addTargetClosure { _ in if let editibalCardTrait = cardController as? EditableCardTrait { editibalCardTrait.onEditButtonTap() @@ -471,3 +471,13 @@ extension CardsViewController { notifyCardsVisibility() } } + +private extension Bundle { + static var controller: Bundle { + #if SWIFT_PACKAGE + return Bundle.module + #else + return Bundle(for: CardsViewController.self) + #endif + } +} diff --git a/CardParts/src/Delegates/CardVisibilityDelegate.swift b/CardParts/src/Delegates/CardVisibilityDelegate.swift index f5c4956b..dd5221a8 100644 --- a/CardParts/src/Delegates/CardVisibilityDelegate.swift +++ b/CardParts/src/Delegates/CardVisibilityDelegate.swift @@ -5,6 +5,10 @@ // Created by Tumer, Deniz on 5/23/18. // +#if SWIFT_PACKAGE +import UIKit +#endif + /* * This protocol handles passing data about the visibility of a card * from an instance of a CardsViewController to the card itself diff --git a/CardParts/src/Extensions/Date.swift b/CardParts/src/Extensions/Date.swift index b113737f..b73f355d 100644 --- a/CardParts/src/Extensions/Date.swift +++ b/CardParts/src/Extensions/Date.swift @@ -6,6 +6,10 @@ // Copyright © 2017 Intuit, Inc. All rights reserved. // +#if SWIFT_PACKAGE +import Foundation +#endif + enum DateFormat : String { case Date = "yyyy'-'MM'-'dd'", DateAndTime = "yyyy'-'MM'-'dd'T'HH':'mm':'ssZ", CreditDateAndTime = "yyyy-MM-dd'T'HH:mm:ss.sssZ", CreditShortDateAndTime = "MMMM yyyy", DateSlashes = "MM/dd/yyyy", abbreviatedMonth = "MMM YYYY", abbreviatedMonthIncludeDate = "MMM d, YYYY" } diff --git a/CardParts/src/Extensions/NSObjectProtocol.swift b/CardParts/src/Extensions/NSObjectProtocol.swift index 8e57803e..e364d1f7 100644 --- a/CardParts/src/Extensions/NSObjectProtocol.swift +++ b/CardParts/src/Extensions/NSObjectProtocol.swift @@ -6,6 +6,10 @@ // Copyright © 2017 Intuit, Inc. All rights reserved. // +#if SWIFT_PACKAGE +import Foundation +#endif + extension NSObjectProtocol { var className: String { return String(describing: type(of: self)) diff --git a/CardParts/src/Extensions/UIButton.swift b/CardParts/src/Extensions/UIButton.swift index 77540141..04d2d0ca 100644 --- a/CardParts/src/Extensions/UIButton.swift +++ b/CardParts/src/Extensions/UIButton.swift @@ -6,6 +6,10 @@ // Copyright © 2017 Intuit, Inc. All rights reserved. // +#if SWIFT_PACKAGE +import UIKit +#endif + typealias UIButtonTargetClosure = (UIButton) -> () extension UIButton { diff --git a/CardParts/src/Extensions/UIColor.swift b/CardParts/src/Extensions/UIColor.swift index b21187d3..873072d2 100644 --- a/CardParts/src/Extensions/UIColor.swift +++ b/CardParts/src/Extensions/UIColor.swift @@ -6,6 +6,10 @@ // Copyright © 2017 Intuit, Inc. All rights reserved. // +#if SWIFT_PACKAGE +import UIKit +#endif + extension UIColor { static var turboGenericGreyTextColor : UIColor {get{return UIColor.color(169, green: 169, blue: 169)}} diff --git a/CardParts/src/Extensions/UIFont.swift b/CardParts/src/Extensions/UIFont.swift index bacd6cb6..17c9a3c9 100644 --- a/CardParts/src/Extensions/UIFont.swift +++ b/CardParts/src/Extensions/UIFont.swift @@ -6,6 +6,10 @@ // Copyright © 2017 Intuit, Inc. All rights reserved. // +#if SWIFT_PACKAGE +import UIKit +#endif + enum FontSize: Int { case ultrabig = 48, header = 36, xx_Large = 28, x_Large = 24, large = 17, medium = 16, normal = 14, small = 12, x_Small = 10 } diff --git a/CardParts/src/Extensions/UIView.swift b/CardParts/src/Extensions/UIView.swift index 55888ba3..2b5fefe9 100644 --- a/CardParts/src/Extensions/UIView.swift +++ b/CardParts/src/Extensions/UIView.swift @@ -5,6 +5,10 @@ // Created by bcarreon1 on 1/30/20. // +#if SWIFT_PACKAGE +import UIKit +#endif + extension UIView { func roundCorners(_ corners: CACornerMask, radius: CGFloat){ if #available(iOS 11.0, *) { diff --git a/CardParts/src/Utilities/CardUtils.swift b/CardParts/src/Utilities/CardUtils.swift index 50b1d201..bf720c7d 100644 --- a/CardParts/src/Utilities/CardUtils.swift +++ b/CardParts/src/Utilities/CardUtils.swift @@ -5,7 +5,11 @@ // Created by Tumer, Deniz on 5/23/18. // +#if SWIFT_PACKAGE +import UIKit +#else import Foundation +#endif /* * Defines utility methods for cards. diff --git a/Example/Tests/CardPartImageViewTests.swift b/Example/Tests/CardPartImageViewTests.swift index ebe79ce1..1a58d549 100644 --- a/Example/Tests/CardPartImageViewTests.swift +++ b/Example/Tests/CardPartImageViewTests.swift @@ -6,6 +6,8 @@ // Copyright © 2017 Mint.com. All rights reserved. // +@testable import CardParts + import XCTest import RxSwift import RxCocoa @@ -23,7 +25,25 @@ class CardPartImageViewTests: XCTestCase { // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } - + + func testAssetResources() { + #if SWIFT_PACKAGE + let arrowdown = UIImage(named: "arrowdown", in: Bundle.module, compatibleWith: nil) + let budgets = UIImage(named: "budgets_disclosure_icon", in: Bundle.module, compatibleWith: nil) + let confetti = UIImage(named: "confetti", in: Bundle.module, compatibleWith: nil) + let diamond = UIImage(named: "diamond", in: Bundle.module, compatibleWith: nil) + let star = UIImage(named: "star", in: Bundle.module, compatibleWith: nil) + let triangle = UIImage(named: "triangle", in: Bundle.module, compatibleWith: nil) + + XCTAssertNotNil(arrowdown) + XCTAssertNotNil(budgets) + XCTAssertNotNil(confetti) + XCTAssertNotNil(diamond) + XCTAssertNotNil(star) + XCTAssertNotNil(triangle) + #endif + } + func testMenuOptionsProperty() { let bag = DisposeBag() diff --git a/Package.resolved b/Package.resolved new file mode 100644 index 00000000..73b53d75 --- /dev/null +++ b/Package.resolved @@ -0,0 +1,34 @@ +{ + "object": { + "pins": [ + { + "package": "RxDataSources", + "repositoryURL": "https://github.com/RxSwiftCommunity/RxDataSources.git", + "state": { + "branch": null, + "revision": "a18cee01c9ee55f04d0c7eb15c77a96c3648c88e", + "version": "4.0.1" + } + }, + { + "package": "RxGesture", + "repositoryURL": "https://github.com/RxSwiftCommunity/RxGesture.git", + "state": { + "branch": null, + "revision": "867f176b6695829e350fafc00b5a849bb46a1857", + "version": "3.0.3" + } + }, + { + "package": "RxSwift", + "repositoryURL": "https://github.com/ReactiveX/RxSwift.git", + "state": { + "branch": null, + "revision": "002d325b0bdee94e7882e1114af5ff4fe1e96afa", + "version": "5.1.1" + } + } + ] + }, + "version": 1 +} diff --git a/Package.swift b/Package.swift new file mode 100644 index 00000000..c91e44cb --- /dev/null +++ b/Package.swift @@ -0,0 +1,38 @@ +// swift-tools-version:5.3 + +import PackageDescription + +let package = Package( + name: "CardParts", + platforms: [ + .iOS(.v10) + ], + products: [ + .library(name: "CardParts", targets: ["CardParts"]), + ], + dependencies: [ + .package(url: "https://github.com/ReactiveX/RxSwift.git", from: "5.0.0"), + .package(url: "https://github.com/RxSwiftCommunity/RxDataSources.git", from: "4.0.0"), + .package(url: "https://github.com/RxSwiftCommunity/RxGesture.git", from: "3.0.0") + ], + targets: [ + .target( + name: "CardParts", + dependencies: [ + .byName(name: "RxSwift"), + .product(name: "RxCocoa", package: "RxSwift"), + .byName(name: "RxDataSources"), + .byName(name: "RxGesture") + ], + path: "CardParts", + resources: [ + .process("Assets/icons.xcassets") + ] + ), + .testTarget( + name: "CardPartsTests", + dependencies: ["CardParts"], + path: "Example/Tests" + ) + ] +) From c3fd8ec40b077be687978daede8ba00556ee9457 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 22 Oct 2020 08:02:16 -0500 Subject: [PATCH 2/4] Commented Bundle extenion properties --- CardParts/src/Classes/Card Parts/CardPartConfettiView.swift | 2 ++ CardParts/src/Classes/Card Parts/CardPartTitleView.swift | 2 ++ CardParts/src/Classes/CardsViewController.swift | 2 ++ Package.swift | 1 + 4 files changed, 7 insertions(+) diff --git a/CardParts/src/Classes/Card Parts/CardPartConfettiView.swift b/CardParts/src/Classes/Card Parts/CardPartConfettiView.swift index 70af5c00..d4cf667f 100644 --- a/CardParts/src/Classes/Card Parts/CardPartConfettiView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartConfettiView.swift @@ -141,6 +141,8 @@ public class CardPartConfettiView: UIView, CardPartView { } private extension Bundle { + + /// Gets the correct Bundle for cenfetti images based on the environment. static var confetti: Bundle { #if SWIFT_PACKAGE return Bundle.module diff --git a/CardParts/src/Classes/Card Parts/CardPartTitleView.swift b/CardParts/src/Classes/Card Parts/CardPartTitleView.swift index 2dac88b8..9d34a8c5 100644 --- a/CardParts/src/Classes/Card Parts/CardPartTitleView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartTitleView.swift @@ -205,6 +205,8 @@ extension Reactive where Base: CardPartTitleView { } private extension Bundle { + + /// Gets the correct Bundle for the `arrowdown` image based on the environment. static var title: Bundle { #if SWIFT_PACKAGE return Bundle.module diff --git a/CardParts/src/Classes/CardsViewController.swift b/CardParts/src/Classes/CardsViewController.swift index 1e8c04af..a309c264 100644 --- a/CardParts/src/Classes/CardsViewController.swift +++ b/CardParts/src/Classes/CardsViewController.swift @@ -473,6 +473,8 @@ extension CardsViewController { } private extension Bundle { + + /// Gets the correct Bundle for the `budgets_disclosure_icon` image based on the environment. static var controller: Bundle { #if SWIFT_PACKAGE return Bundle.module diff --git a/Package.swift b/Package.swift index c91e44cb..85ad2b6e 100644 --- a/Package.swift +++ b/Package.swift @@ -25,6 +25,7 @@ let package = Package( .byName(name: "RxGesture") ], path: "CardParts", + exclude: ["Example"], resources: [ .process("Assets/icons.xcassets") ] From 301700db69bc8351216f6a6f30630b7b80815fc1 Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 22 Oct 2020 08:04:56 -0500 Subject: [PATCH 3/4] Added .swiftpm/ directory to .gitignore --- .gitignore | 1 + .../xcode/package.xcworkspace/contents.xcworkspacedata | 7 ------- 2 files changed, 1 insertion(+), 7 deletions(-) delete mode 100644 .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata diff --git a/.gitignore b/.gitignore index 6a6c9906..f87492cb 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,7 @@ playground.xcworkspace # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. # Packages/ .build/ +.swiftpm/ # CocoaPods # diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a6..00000000 --- a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - From c331fd19c44c83f42998ab03b06cdf4aebb2e10d Mon Sep 17 00:00:00 2001 From: Caleb Kleveter Date: Thu, 22 Oct 2020 08:10:15 -0500 Subject: [PATCH 4/4] Excluded Info.plist from CardPartsTests test target --- Package.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index 85ad2b6e..2ea8268d 100644 --- a/Package.swift +++ b/Package.swift @@ -25,7 +25,6 @@ let package = Package( .byName(name: "RxGesture") ], path: "CardParts", - exclude: ["Example"], resources: [ .process("Assets/icons.xcassets") ] @@ -33,7 +32,8 @@ let package = Package( .testTarget( name: "CardPartsTests", dependencies: ["CardParts"], - path: "Example/Tests" + path: "Example/Tests", + exclude: ["Info.plist"] ) ] )