diff --git a/DatWeatherDoe.xcodeproj/project.pbxproj b/DatWeatherDoe.xcodeproj/project.pbxproj index 09e98a4..114b7be 100644 --- a/DatWeatherDoe.xcodeproj/project.pbxproj +++ b/DatWeatherDoe.xcodeproj/project.pbxproj @@ -39,7 +39,6 @@ 20459C641C5C50DA004D0DC1 /* ConfigManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20459C631C5C50DA004D0DC1 /* ConfigManager.swift */; }; 206523C826597B120026C506 /* WeatherError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 206523C726597B120026C506 /* WeatherError.swift */; }; 206523D62659A92B0026C506 /* WeatherDataBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 206523D52659A92B0026C506 /* WeatherDataBuilder.swift */; }; - 206523DD265ABDF30026C506 /* ConfigManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 206523DC265ABDF30026C506 /* ConfigManagerTests.swift */; }; 206523FB265AD5730026C506 /* WeatherSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 206523FA265AD5730026C506 /* WeatherSource.swift */; }; 206523FD265AF03E0026C506 /* RefreshInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = 206523FC265AF03E0026C506 /* RefreshInterval.swift */; }; 206E15252A7C4C5C0096D33C /* ConfigOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 206E15242A7C4C5C0096D33C /* ConfigOptions.swift */; }; @@ -122,7 +121,6 @@ 20459C631C5C50DA004D0DC1 /* ConfigManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfigManager.swift; sourceTree = ""; }; 206523C726597B120026C506 /* WeatherError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeatherError.swift; sourceTree = ""; }; 206523D52659A92B0026C506 /* WeatherDataBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeatherDataBuilder.swift; sourceTree = ""; }; - 206523DC265ABDF30026C506 /* ConfigManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigManagerTests.swift; sourceTree = ""; }; 206523FA265AD5730026C506 /* WeatherSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeatherSource.swift; sourceTree = ""; }; 206523FC265AF03E0026C506 /* RefreshInterval.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RefreshInterval.swift; sourceTree = ""; }; 206E15242A7C4C5C0096D33C /* ConfigOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigOptions.swift; sourceTree = ""; }; @@ -445,14 +443,6 @@ path = Coordinates; sourceTree = ""; }; - 20B9CDC827B8316000C42508 /* Config */ = { - isa = PBXGroup; - children = ( - 206523DC265ABDF30026C506 /* ConfigManagerTests.swift */, - ); - path = Config; - sourceTree = ""; - }; 20B9CDC927B8323900C42508 /* UI */ = { isa = PBXGroup; children = ( @@ -517,7 +507,6 @@ children = ( 207E989B26838D0D00DC2162 /* DatWeatherDoe.xctestplan */, 2074949627A09263002AA589 /* API */, - 20B9CDC827B8316000C42508 /* Config */, 20B9CDC927B8323900C42508 /* UI */, ); path = DatWeatherDoeTests; @@ -583,7 +572,7 @@ attributes = { BuildIndependentTargetsInParallel = YES; LastSwiftUpdateCheck = 1330; - LastUpgradeCheck = 1600; + LastUpgradeCheck = 2600; ORGANIZATIONNAME = "Inder Dhir"; TargetAttributes = { 2023EDA21C4ED09C0087FD67 = { @@ -725,7 +714,6 @@ files = ( 2074949927A09278002AA589 /* WeatherURLBuilderTests.swift in Sources */, 20B9CDCF27B8335A00C42508 /* TemperatureUnitTests.swift in Sources */, - 206523DD265ABDF30026C506 /* ConfigManagerTests.swift in Sources */, 20B3845F27A1CFE800F85482 /* LocationValidatorTests.swift in Sources */, 20B9CDD127B833EE00C42508 /* RefreshIntervalTests.swift in Sources */, 20B9CDCD27B8325900C42508 /* WeatherSourceTests.swift in Sources */, @@ -799,6 +787,7 @@ MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; + STRING_CATALOG_GENERATE_SYMBOLS = YES; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 6.0; @@ -852,6 +841,7 @@ MACOSX_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; + STRING_CATALOG_GENERATE_SYMBOLS = YES; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_OPTIMIZATION_LEVEL = "-O"; @@ -867,11 +857,14 @@ CODE_SIGN_IDENTITY = "Mac Developer"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 52; + CURRENT_PROJECT_VERSION = 53; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"DatWeatherDoe/Resources/DevelopmentAssets\" \"DatWeatherDoe/Resources/DevelopmentAssets/TestData.swift\""; DEVELOPMENT_TEAM = Q8X4D3A8MT; + ENABLE_APP_SANDBOX = YES; ENABLE_HARDENED_RUNTIME = YES; + ENABLE_OUTGOING_NETWORK_CONNECTIONS = YES; + ENABLE_RESOURCE_ACCESS_LOCATION = YES; INFOPLIST_FILE = "$(SRCROOT)/DatWeatherDoe/Resources/Info.plist"; INFOPLIST_KEY_CFBundleDisplayName = DatWeatherDoe; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.weather"; @@ -879,7 +872,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 5.4.0; + MARKETING_VERSION = 5.5.0; PRODUCT_BUNDLE_IDENTIFIER = com.inderdhir.DatWeatherDoe.debug; PRODUCT_NAME = DatWeatherDoe; PROVISIONING_PROFILE = ""; @@ -896,11 +889,14 @@ CODE_SIGN_IDENTITY = "Mac Developer"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 52; + CURRENT_PROJECT_VERSION = 53; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"DatWeatherDoe/Resources/DevelopmentAssets\" \"DatWeatherDoe/Resources/DevelopmentAssets/TestData.swift\""; DEVELOPMENT_TEAM = Q8X4D3A8MT; + ENABLE_APP_SANDBOX = YES; ENABLE_HARDENED_RUNTIME = YES; + ENABLE_OUTGOING_NETWORK_CONNECTIONS = YES; + ENABLE_RESOURCE_ACCESS_LOCATION = YES; INFOPLIST_FILE = "$(SRCROOT)/DatWeatherDoe/Resources/Info.plist"; INFOPLIST_KEY_CFBundleDisplayName = DatWeatherDoe; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.weather"; @@ -908,7 +904,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 5.4.0; + MARKETING_VERSION = 5.5.0; PRODUCT_BUNDLE_IDENTIFIER = com.inderdhir.DatWeatherDoe; PRODUCT_NAME = DatWeatherDoe; PROVISIONING_PROFILE = ""; @@ -927,6 +923,7 @@ DEAD_CODE_STRIPPING = YES; DEVELOPMENT_TEAM = Q8X4D3A8MT; GENERATE_INFOPLIST_FILE = YES; + MACOSX_DEPLOYMENT_TARGET = 14.0; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.inderdhir.DefaultsTests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -945,6 +942,7 @@ DEAD_CODE_STRIPPING = YES; DEVELOPMENT_TEAM = ""; GENERATE_INFOPLIST_FILE = YES; + MACOSX_DEPLOYMENT_TARGET = 14.0; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.inderdhir.DefaultsTests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -991,7 +989,7 @@ repositoryURL = "https://github.com/nicklockwood/SwiftFormat"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 0.54.0; + minimumVersion = 0.57.2; }; }; 20012FA4267980EE00553B60 /* XCRemoteSwiftPackageReference "Reachability" */ = { @@ -999,7 +997,7 @@ repositoryURL = "https://github.com/ashleymills/Reachability.swift"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 5.2.3; + minimumVersion = 5.2.4; }; }; 2039B4052C2920BF006A6B6D /* XCRemoteSwiftPackageReference "MenuBarExtraAccess" */ = { @@ -1007,7 +1005,7 @@ repositoryURL = "https://github.com/orchetect/MenuBarExtraAccess"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 1.0.5; + minimumVersion = 1.2.2; }; }; 20CB68BC2A2D9029001C73B9 /* XCRemoteSwiftPackageReference "SwiftLint" */ = { @@ -1015,7 +1013,7 @@ repositoryURL = "https://github.com/realm/SwiftLint"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 0.55.1; + minimumVersion = 0.61.0; }; }; /* End XCRemoteSwiftPackageReference section */ diff --git a/DatWeatherDoe.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DatWeatherDoe.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 93bae09..1b6eed4 100644 --- a/DatWeatherDoe.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DatWeatherDoe.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -15,8 +15,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/krzyzanowskim/CryptoSwift.git", "state" : { - "revision" : "678d442c6f7828def400a70ae15968aef67ef52d", - "version" : "1.8.3" + "revision" : "e45a26384239e028ec87fbcc788f513b67e10d8f", + "version" : "1.9.0" } }, { @@ -24,8 +24,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/orchetect/MenuBarExtraAccess", "state" : { - "revision" : "9ff6cbb0ba373527a19832a0791cea4a41ad7a6f", - "version" : "1.1.3" + "revision" : "707dff6f55217b3ef5b6be84ced3e83511d4df5c", + "version" : "1.2.2" } }, { @@ -42,8 +42,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/jpsim/SourceKitten.git", "state" : { - "revision" : "fd4df99170f5e9d7cf9aa8312aa8506e0e7a44e7", - "version" : "0.35.0" + "revision" : "731ffe6a35344a19bab00cdca1c952d5b4fee4d8", + "version" : "0.37.2" } }, { @@ -51,8 +51,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-argument-parser.git", "state" : { - "revision" : "41982a3656a71c768319979febd796c6fd111d5c", - "version" : "1.5.0" + "revision" : "309a47b2b1d9b5e991f36961c983ecec72275be3", + "version" : "1.6.1" } }, { @@ -60,8 +60,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/swiftlang/swift-syntax.git", "state" : { - "revision" : "515f79b522918f83483068d99c68daeb5116342d", - "version" : "600.0.0-prerelease-2024-08-14" + "revision" : "21b3b45635decd1a0b89968f81b6d9a93128f773", + "version" : "602.0.0-prerelease-2025-08-11" } }, { @@ -69,8 +69,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/nicklockwood/SwiftFormat", "state" : { - "revision" : "86ed20990585f478c0daf309af645c2a528b59d8", - "version" : "0.54.6" + "revision" : "b83a8f132ff5430f3b6ff7d912baa407caea9e29", + "version" : "0.57.2" } }, { @@ -78,8 +78,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/realm/SwiftLint", "state" : { - "revision" : "168fb98ed1f3e343d703ecceaf518b6cf565207b", - "version" : "0.57.0" + "revision" : "cc6fbaf355caf9ebe02c1b631a8edaa6df9145c5", + "version" : "0.61.0" } }, { @@ -105,8 +105,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/jpsim/Yams.git", "state" : { - "revision" : "3036ba9d69cf1fd04d433527bc339dc0dc75433d", - "version" : "5.1.3" + "revision" : "d41ba4e7164c0838c6d48351f7575f7f762151fe", + "version" : "6.1.0" } } ], diff --git a/DatWeatherDoe.xcodeproj/xcshareddata/xcschemes/DatWeatherDoe.xcscheme b/DatWeatherDoe.xcodeproj/xcshareddata/xcschemes/DatWeatherDoe.xcscheme index 979dc46..6be4472 100644 --- a/DatWeatherDoe.xcodeproj/xcshareddata/xcschemes/DatWeatherDoe.xcscheme +++ b/DatWeatherDoe.xcodeproj/xcshareddata/xcschemes/DatWeatherDoe.xcscheme @@ -1,6 +1,6 @@ Void) { + private func setup(callback: @escaping () -> Void) { do { reachability = try Reachability() try reachability?.startNotifier() diff --git a/DatWeatherDoe/Resources/DatWeatherDoe.entitlements b/DatWeatherDoe/Resources/DatWeatherDoe.entitlements index fc07546..0c67376 100644 --- a/DatWeatherDoe/Resources/DatWeatherDoe.entitlements +++ b/DatWeatherDoe/Resources/DatWeatherDoe.entitlements @@ -1,12 +1,5 @@ - - com.apple.security.app-sandbox - - com.apple.security.network.client - - com.apple.security.personal-information.location - - + diff --git a/DatWeatherDoe/Resources/DevelopmentAssets/TestData.swift b/DatWeatherDoe/Resources/DevelopmentAssets/TestData.swift index ca7d44d..1786be8 100644 --- a/DatWeatherDoe/Resources/DevelopmentAssets/TestData.swift +++ b/DatWeatherDoe/Resources/DevelopmentAssets/TestData.swift @@ -31,7 +31,7 @@ let response = WeatherAPIResponse( windData: .init(speedMph: 12.3, degrees: 305, direction: "NW"), uvIndex: 7.0, forecastDayData: .init( - temp: .init( + temperatureData: .init( maxTempC: 32.8, maxTempF: 91.0, minTempC: 20.6, minTempF: 69.2 ), astro: .init(sunrise: "05:26 AM", sunset: "08:31 PM"), diff --git a/DatWeatherDoe/UI/Configure/ConfigureOptionsView.swift b/DatWeatherDoe/UI/Configure/ConfigureOptionsView.swift index 7e25377..0adb9f6 100644 --- a/DatWeatherDoe/UI/Configure/ConfigureOptionsView.swift +++ b/DatWeatherDoe/UI/Configure/ConfigureOptionsView.swift @@ -89,11 +89,9 @@ struct ConfigureOptionsView: View { } } -struct ConfigureOptionsView_Previews: PreviewProvider { - static var previews: some View { - ConfigureOptionsView( - viewModel: .init(configManager: ConfigManager()) - ) - .frame(width: 380) - } +#Preview { + ConfigureOptionsView( + viewModel: .init(configManager: ConfigManager()) + ) + .frame(width: 380) } diff --git a/DatWeatherDoe/UI/Configure/ConfigureUnitOptionsView.swift b/DatWeatherDoe/UI/Configure/ConfigureUnitOptionsView.swift index 39361b4..e9e9e18 100644 --- a/DatWeatherDoe/UI/Configure/ConfigureUnitOptionsView.swift +++ b/DatWeatherDoe/UI/Configure/ConfigureUnitOptionsView.swift @@ -28,12 +28,10 @@ struct ConfigureUnitOptionsView: View { } } -struct ConfigureUnitOptionsView_Previews: PreviewProvider { - static var previews: some View { - Grid { - ConfigureUnitOptionsView( - viewModel: .init(configManager: ConfigManager()) - ) - } +#Preview { + Grid { + ConfigureUnitOptionsView( + viewModel: .init(configManager: ConfigManager()) + ) } } diff --git a/DatWeatherDoe/UI/Configure/ConfigureValueSeparatorOptionsView.swift b/DatWeatherDoe/UI/Configure/ConfigureValueSeparatorOptionsView.swift index f4846cd..9ec23e5 100644 --- a/DatWeatherDoe/UI/Configure/ConfigureValueSeparatorOptionsView.swift +++ b/DatWeatherDoe/UI/Configure/ConfigureValueSeparatorOptionsView.swift @@ -24,10 +24,8 @@ struct ConfigureValueSeparatorOptionsView: View { } } -struct ConfigureValueSeparatorOptionsView_Previews: PreviewProvider { - static var previews: some View { - ConfigureValueSeparatorOptionsView( - viewModel: .init(configManager: ConfigManager()) - ) - } +#Preview { + ConfigureValueSeparatorOptionsView( + viewModel: .init(configManager: ConfigManager()) + ) } diff --git a/DatWeatherDoe/UI/Configure/ConfigureView.swift b/DatWeatherDoe/UI/Configure/ConfigureView.swift index 0e1e1ec..f8dc63f 100644 --- a/DatWeatherDoe/UI/Configure/ConfigureView.swift +++ b/DatWeatherDoe/UI/Configure/ConfigureView.swift @@ -44,13 +44,11 @@ struct ConfigureView: View { } } -struct ConfigureView_Previews: PreviewProvider { - static var previews: some View { - ConfigureView( - viewModel: .init(configManager: ConfigManager()), - version: "5.0.0", - onSave: {}, - onQuit: {} - ) - } +#Preview { + ConfigureView( + viewModel: .init(configManager: ConfigManager()), + version: "5.0.0", + onSave: {}, + onQuit: {} + ) } diff --git a/DatWeatherDoe/UI/Configure/ConfigureWeatherOptionsView.swift b/DatWeatherDoe/UI/Configure/ConfigureWeatherOptionsView.swift index ee772d0..c038ea0 100644 --- a/DatWeatherDoe/UI/Configure/ConfigureWeatherOptionsView.swift +++ b/DatWeatherDoe/UI/Configure/ConfigureWeatherOptionsView.swift @@ -38,12 +38,10 @@ struct ConfigureWeatherOptionsView: View { } } -struct ConfigureWeatherOptionsView_Previews: PreviewProvider { - static var previews: some View { - Grid { - ConfigureWeatherOptionsView( - viewModel: .init(configManager: ConfigManager()) - ) - } +#Preview { + Grid { + ConfigureWeatherOptionsView( + viewModel: .init(configManager: ConfigManager()) + ) } } diff --git a/DatWeatherDoe/UI/Configure/Options/MeasurementUnit.swift b/DatWeatherDoe/UI/Configure/Options/MeasurementUnit.swift index 9ca2cb9..1460434 100644 --- a/DatWeatherDoe/UI/Configure/Options/MeasurementUnit.swift +++ b/DatWeatherDoe/UI/Configure/Options/MeasurementUnit.swift @@ -16,11 +16,11 @@ enum MeasurementUnit: String, CaseIterable, Identifiable { var temperatureUnit: TemperatureUnit { switch self { case .metric: - return .celsius + .celsius case .imperial: - return .fahrenheit + .fahrenheit case .all: - return .all + .all } } } diff --git a/DatWeatherDoe/UI/Configure/Options/RefreshInterval.swift b/DatWeatherDoe/UI/Configure/Options/RefreshInterval.swift index fc10242..d4b63ed 100644 --- a/DatWeatherDoe/UI/Configure/Options/RefreshInterval.swift +++ b/DatWeatherDoe/UI/Configure/Options/RefreshInterval.swift @@ -19,13 +19,13 @@ enum RefreshInterval: TimeInterval, CaseIterable, Identifiable { var title: String { switch self { case .fiveMinutes: - return NSLocalizedString("5 min", comment: "5 min refresh interval") + NSLocalizedString("5 min", comment: "5 min refresh interval") case .fifteenMinutes: - return NSLocalizedString("15 min", comment: "15 min refresh interval") + NSLocalizedString("15 min", comment: "15 min refresh interval") case .thirtyMinutes: - return NSLocalizedString("30 min", comment: "30 min refresh interval") + NSLocalizedString("30 min", comment: "30 min refresh interval") case .sixtyMinutes: - return NSLocalizedString("60 min", comment: "60 min refresh interval") + NSLocalizedString("60 min", comment: "60 min refresh interval") } } } diff --git a/DatWeatherDoe/UI/Configure/Options/TemperatureUnit.swift b/DatWeatherDoe/UI/Configure/Options/TemperatureUnit.swift index 035cb71..2e24fe9 100644 --- a/DatWeatherDoe/UI/Configure/Options/TemperatureUnit.swift +++ b/DatWeatherDoe/UI/Configure/Options/TemperatureUnit.swift @@ -16,11 +16,11 @@ enum TemperatureUnit: String, CaseIterable, Identifiable { var unitString: String { switch self { case .fahrenheit: - return "F" + "F" case .celsius: - return "C" + "C" case .all: - return "All" + "All" } } diff --git a/DatWeatherDoe/UI/Configure/Options/WeatherConditionPosition.swift b/DatWeatherDoe/UI/Configure/Options/WeatherConditionPosition.swift index a8cac64..b2ca775 100644 --- a/DatWeatherDoe/UI/Configure/Options/WeatherConditionPosition.swift +++ b/DatWeatherDoe/UI/Configure/Options/WeatherConditionPosition.swift @@ -16,9 +16,9 @@ enum WeatherConditionPosition: String, Identifiable { var title: String { switch self { case .beforeTemperature: - return NSLocalizedString("Before Temperature", comment: "Weather condition before temperature") + NSLocalizedString("Before Temperature", comment: "Weather condition before temperature") case .afterTemperature: - return NSLocalizedString("After Temperature", comment: "Weather condition after temperature") + NSLocalizedString("After Temperature", comment: "Weather condition after temperature") } } } diff --git a/DatWeatherDoe/UI/Configure/Options/WeatherSource.swift b/DatWeatherDoe/UI/Configure/Options/WeatherSource.swift index 689fcf9..90789e9 100644 --- a/DatWeatherDoe/UI/Configure/Options/WeatherSource.swift +++ b/DatWeatherDoe/UI/Configure/Options/WeatherSource.swift @@ -14,27 +14,27 @@ enum WeatherSource: String, CaseIterable { var title: String { switch self { case .location: - return NSLocalizedString("Location", comment: "Weather based on location") + NSLocalizedString("Location", comment: "Weather based on location") case .latLong: - return NSLocalizedString("Lat/Long", comment: "Weather based on Lat/Long") + NSLocalizedString("Lat/Long", comment: "Weather based on Lat/Long") } } var placeholder: String { switch self { case .location: - return "" + "" case .latLong: - return "42,42" + "42,42" } } var textHint: String { switch self { case .location: - return "" + "" case .latLong: - return NSLocalizedString( + NSLocalizedString( "[latitude],[longitude]", comment: "Placeholder hint for entering Lat/Long" ) diff --git a/DatWeatherDoe/ViewModel/WeatherDataFormatter.swift b/DatWeatherDoe/ViewModel/WeatherDataFormatter.swift index f079618..da91d74 100644 --- a/DatWeatherDoe/ViewModel/WeatherDataFormatter.swift +++ b/DatWeatherDoe/ViewModel/WeatherDataFormatter.swift @@ -34,7 +34,7 @@ final class WeatherDataFormatter: WeatherDataFormatterType { func getWeatherText(for data: WeatherData) -> String { TemperatureForecastTextBuilder( temperatureData: data.response.temperatureData, - forecastTemperatureData: data.response.forecastDayData.temp, + forecastTemperatureData: data.response.forecastDayData.temperatureData, options: .init( unit: configManager.parsedMeasurementUnit.temperatureUnit, isRoundingOff: configManager.isRoundingOffData, diff --git a/DatWeatherDoeTests/API/Repository/Location/Coordinates/LocationValidatorTests.swift b/DatWeatherDoeTests/API/Repository/Location/Coordinates/LocationValidatorTests.swift index 2253df0..c4e4788 100644 --- a/DatWeatherDoeTests/API/Repository/Location/Coordinates/LocationValidatorTests.swift +++ b/DatWeatherDoeTests/API/Repository/Location/Coordinates/LocationValidatorTests.swift @@ -7,14 +7,21 @@ // @testable import DatWeatherDoe -import XCTest +import Testing -class LocationValidatorTests: XCTestCase { - func testLocation_empty() { - XCTAssertThrowsError(try LocationValidator(latLong: "").validate()) +struct LocationValidatorTests { + + @Test + func testLocation_empty() async throws { + #expect(throws: (any Error).self) { + try LocationValidator(latLong: "").validate() + } } - func testLocation_correct() { - XCTAssertNoThrow(try LocationValidator(latLong: "12,24").validate()) + @Test + func testLocation_correct() async throws { + #expect(throws: Never.self) { + try LocationValidator(latLong: "12,24").validate() + } } } diff --git a/DatWeatherDoeTests/API/Repository/WeatherURLBuilderTests.swift b/DatWeatherDoeTests/API/Repository/WeatherURLBuilderTests.swift index d472429..d36898a 100644 --- a/DatWeatherDoeTests/API/Repository/WeatherURLBuilderTests.swift +++ b/DatWeatherDoeTests/API/Repository/WeatherURLBuilderTests.swift @@ -7,14 +7,17 @@ // @testable import DatWeatherDoe -import XCTest +import Foundation +import Testing -final class WeatherURLBuilderTests: XCTestCase { - func testBuild() { - XCTAssertEqual( - try? WeatherURLBuilder(appId: "123456", location: .init(latitude: 42, longitude: 42)).build().absoluteString, - "https://api.weatherapi.com/v1/forecast.json?key=123456&aqi=no&q=42.0,42.0&dt=\(parsedDateToday)" - ) +struct WeatherURLBuilderTests { + + @Test func testBuild() async throws { + let urlString = try WeatherURLBuilder( + appId: "123456", + location: .init(latitude: 42, longitude: 42) + ).build().absoluteString + #expect(urlString == "https://api.weatherapi.com/v1/forecast.json?key=123456&aqi=yes&q=42.0,42.0&dt=\(parsedDateToday)") } private var parsedDateToday: String { diff --git a/DatWeatherDoeTests/Config/ConfigManagerTests.swift b/DatWeatherDoeTests/Config/ConfigManagerTests.swift deleted file mode 100644 index c4a006e..0000000 --- a/DatWeatherDoeTests/Config/ConfigManagerTests.swift +++ /dev/null @@ -1,116 +0,0 @@ -// -// ConfigManagerTests.swift -// DefaultsTests -// -// Created by Inder Dhir on 5/23/21. -// Copyright © 2021 Inder Dhir. All rights reserved. -// - -@testable import DatWeatherDoe -import XCTest - -final class ConfigManagerTests: XCTestCase { - var configManager: ConfigManagerType! - - override func setUp() { - super.setUp() - clearUserDefaults() - } - - func testDefaultMeasurementUnit() { - XCTAssertEqual(configManager.measurementUnit, MeasurementUnit.imperial.rawValue) - } - - func testMeasurementUnitSaved() { - XCTAssertEqual(configManager.measurementUnit, MeasurementUnit.imperial.rawValue) - configManager.measurementUnit = MeasurementUnit.metric.rawValue - XCTAssertEqual(configManager.measurementUnit, MeasurementUnit.metric.rawValue) - } - - func testDefaultWeatherSource() { - XCTAssertEqual(configManager.weatherSource, WeatherSource.location.rawValue) - } - - func testDefaultWeatherSourceSaved() { - XCTAssertEqual(configManager.weatherSource, WeatherSource.location.rawValue) - configManager.weatherSource = WeatherSource.latLong.rawValue - XCTAssertEqual(configManager.weatherSource, WeatherSource.latLong.rawValue) - } - - func testDefaultWeatherSourceText() { - XCTAssertEqual(configManager.weatherSourceText, nil) - } - - func testWeatherSourceTextSaved() { - XCTAssertEqual(configManager.weatherSourceText, nil) - configManager.weatherSourceText = "40,40" - XCTAssertEqual(configManager.weatherSourceText, "40,40") - } - - func testDefaultRefreshInterval() { - XCTAssertEqual(configManager.refreshInterval, 900) - } - - func testRefreshIntervalSaved() { - XCTAssertEqual(configManager.refreshInterval, 900) - configManager.refreshInterval = 300 - XCTAssertEqual(configManager.refreshInterval, 300) - } - - func testDefaultShowingHumidity() { - XCTAssertEqual(configManager.isShowingHumidity, false) - } - - func testShowingHumiditySaved() { - XCTAssertEqual(configManager.isShowingHumidity, false) - configManager.isShowingHumidity = true - XCTAssertEqual(configManager.isShowingHumidity, true) - } - - func testDefaultRoundingOffData() { - XCTAssertEqual(configManager.isRoundingOffData, false) - } - - func testDefaultUnitLetterOffOffData() { - XCTAssertEqual(configManager.isUnitLetterOff, false) - } - - func testDefaultisUnitSymbolOff() { - XCTAssertEqual(configManager.isUnitSymbolOff, false) - } - - func testRoundingOffDataSaved() { - XCTAssertEqual(configManager.isRoundingOffData, false) - configManager.isRoundingOffData = true - XCTAssertEqual(configManager.isRoundingOffData, true) - } - - func testUnitLetterOffSaved() { - XCTAssertEqual(configManager.isUnitLetterOff, false) - configManager.isUnitLetterOff = true - XCTAssertEqual(configManager.isUnitLetterOff, true) - } - - func testUnitSymbolOffSaved() { - XCTAssertEqual(configManager.isUnitSymbolOff, false) - configManager.isUnitSymbolOff = true - XCTAssertEqual(configManager.isUnitSymbolOff, true) - } - - func testWeatherConditionAsTextDefault() { - XCTAssertEqual(configManager.isWeatherConditionAsTextEnabled, false) - } - - func testWeatherConditionAsTextSaved() { - XCTAssertEqual(configManager.isWeatherConditionAsTextEnabled, false) - configManager.isWeatherConditionAsTextEnabled = true - XCTAssertEqual(configManager.isWeatherConditionAsTextEnabled, true) - } - - private func clearUserDefaults() { - let appDomain = Bundle.main.bundleIdentifier ?? "DatWeatherDoe" - UserDefaults.resetStandardUserDefaults() - UserDefaults.standard.removePersistentDomain(forName: appDomain) - configManager = ConfigManager() - } -} diff --git a/DatWeatherDoeTests/UI/Configure/Options/RefreshIntervalTests.swift b/DatWeatherDoeTests/UI/Configure/Options/RefreshIntervalTests.swift index 7284b7c..dbe96b5 100644 --- a/DatWeatherDoeTests/UI/Configure/Options/RefreshIntervalTests.swift +++ b/DatWeatherDoeTests/UI/Configure/Options/RefreshIntervalTests.swift @@ -7,20 +7,23 @@ // @testable import DatWeatherDoe -import XCTest +import Testing -final class RefreshIntervalTests: XCTestCase { - func testRefreshIntervalTimes() { - XCTAssertEqual(RefreshInterval.fiveMinutes.rawValue, 300) - XCTAssertEqual(RefreshInterval.fifteenMinutes.rawValue, 900) - XCTAssertEqual(RefreshInterval.thirtyMinutes.rawValue, 1800) - XCTAssertEqual(RefreshInterval.sixtyMinutes.rawValue, 3600) +struct RefreshIntervalTests { + + @Test + func refreshIntervalTimes() { + #expect(RefreshInterval.fiveMinutes.rawValue == 300) + #expect(RefreshInterval.fifteenMinutes.rawValue == 900) + #expect(RefreshInterval.thirtyMinutes.rawValue == 1800) + #expect(RefreshInterval.sixtyMinutes.rawValue == 3600) } - func testRefreshintervalStrings() { - XCTAssertEqual(RefreshInterval.fiveMinutes.title, "5 min") - XCTAssertEqual(RefreshInterval.fifteenMinutes.title, "15 min") - XCTAssertEqual(RefreshInterval.thirtyMinutes.title, "30 min") - XCTAssertEqual(RefreshInterval.sixtyMinutes.title, "60 min") + @Test + func refreshintervalStrings() { + #expect(RefreshInterval.fiveMinutes.title == "5 min") + #expect(RefreshInterval.fifteenMinutes.title == "15 min") + #expect(RefreshInterval.thirtyMinutes.title == "30 min") + #expect(RefreshInterval.sixtyMinutes.title == "60 min") } } diff --git a/DatWeatherDoeTests/UI/Configure/Options/TemperatureUnitTests.swift b/DatWeatherDoeTests/UI/Configure/Options/TemperatureUnitTests.swift index 2a6910c..3eadb3f 100644 --- a/DatWeatherDoeTests/UI/Configure/Options/TemperatureUnitTests.swift +++ b/DatWeatherDoeTests/UI/Configure/Options/TemperatureUnitTests.swift @@ -7,27 +7,31 @@ // @testable import DatWeatherDoe -import XCTest +import Testing -final class TemperatureUnitTests: XCTestCase { - func testFahrenheit() { +struct TemperatureUnitTests { + + @Test + func fahrenheit() { let fahrenheitUnit = TemperatureUnit.fahrenheit - XCTAssertEqual(fahrenheitUnit.unitString, "F") - XCTAssertEqual(fahrenheitUnit.degreesString, "\u{00B0}F") + #expect(fahrenheitUnit.unitString == "F") + #expect(fahrenheitUnit.degreesString == "\u{00B0}F") } - func testCelsius() { + @Test + func celsius() { let fahrenheitUnit = TemperatureUnit.celsius - XCTAssertEqual(fahrenheitUnit.unitString, "C") - XCTAssertEqual(fahrenheitUnit.degreesString, "\u{00B0}C") + #expect(fahrenheitUnit.unitString == "C") + #expect(fahrenheitUnit.degreesString == "\u{00B0}C") } - func testAll() { + @Test + func all() { let fahrenheitUnit = TemperatureUnit.all - XCTAssertEqual(fahrenheitUnit.unitString, "All") - XCTAssertEqual(fahrenheitUnit.degreesString, "\u{00B0}All") + #expect(fahrenheitUnit.unitString == "All") + #expect(fahrenheitUnit.degreesString == "\u{00B0}All") } } diff --git a/DatWeatherDoeTests/UI/Configure/Options/WeatherSourceTests.swift b/DatWeatherDoeTests/UI/Configure/Options/WeatherSourceTests.swift index acf0942..8e6b52f 100644 --- a/DatWeatherDoeTests/UI/Configure/Options/WeatherSourceTests.swift +++ b/DatWeatherDoeTests/UI/Configure/Options/WeatherSourceTests.swift @@ -7,22 +7,25 @@ // @testable import DatWeatherDoe -import XCTest +import Testing -final class WeatherSourceTests: XCTestCase { - func testLocationSource() { +struct WeatherSourceTests { + + @Test + func locationSource() { let locationSource = WeatherSource.location - XCTAssertEqual(locationSource.title, "Location") - XCTAssertEqual(locationSource.placeholder, "") - XCTAssertEqual(locationSource.textHint, "") + #expect(locationSource.title == "Location") + #expect(locationSource.placeholder == "") + #expect(locationSource.textHint == "") } - func testLatLongSource() { + @Test + func latLongSource() { let latLongSource = WeatherSource.latLong - XCTAssertEqual(latLongSource.title, "Lat/Long") - XCTAssertEqual(latLongSource.placeholder, "42,42") - XCTAssertEqual(latLongSource.textHint, "[latitude],[longitude]") + #expect(latLongSource.title == "Lat/Long") + #expect(latLongSource.placeholder == "42,42") + #expect(latLongSource.textHint == "[latitude],[longitude]") } }