diff --git a/.gitignore b/.gitignore index 89d806e..73ecccc 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ xcuserdata # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. # Packages/ .build/ +.swiftpm/ # CocoaPods # diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..08aae1d --- /dev/null +++ b/Package.swift @@ -0,0 +1,26 @@ +// swift-tools-version:5.3 + +import PackageDescription + +let package = Package( + name: "Solar", + products: [ + .library(name: "Solar", targets: ["Solar"]), + ], + dependencies: [ ], + targets: [ + .target( + name: "Solar", + dependencies: [], + path: "Solar", + exclude: ["Info-iOS.plist", "Info-watchOS.plist"]), + + .testTarget( + name: "SolarTests", + dependencies: ["Solar"], + path: "Solar iOSTests", + exclude: ["Info.plist"], + resources: [.copy("CorrectResults.json")] + ), + ] +) diff --git a/Solar iOSTests/Solar_iOSTests.swift b/Solar iOSTests/Solar_iOSTests.swift index fee1311..dbc5860 100644 --- a/Solar iOSTests/Solar_iOSTests.swift +++ b/Solar iOSTests/Solar_iOSTests.swift @@ -19,8 +19,14 @@ final class Solar_iOSTests: XCTestCase { private let testAccuracy: TimeInterval = 60 * 5 private lazy var cities: [City] = { + #if SWIFT_PACKAGE + let bundle = Bundle.module + #else + let bundle = Bundle(for: type(of: self)) + #endif + guard - let resultsURLString = Bundle(for: type(of: self)).path(forResource: "CorrectResults", ofType: "json"), + let resultsURLString = bundle.path(forResource: "CorrectResults", ofType: "json"), let data = try? Data(contentsOf: URL(fileURLWithPath: resultsURLString)), let dictionary = try? JSONSerialization.jsonObject(with: data, options: []), let cityDictionaries = dictionary as? [[String : Any]] diff --git a/Solar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Solar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Solar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + +