WeatherProvider / NationalWeatherService-Swift

A multi-platform Swift wrapper for the National Weather Service's weather.gov API.
10 stars 10 forks source link

US or SI (metric) results #9

Closed roblabs closed 2 years ago

roblabs commented 2 years ago

Allow API customers to set the Swift Foundation UnitTemperature to get either US or SI (metric) results from the API


Example usage with this change:

SI (metric) units

"A chance of rain showers. Mostly cloudy, with a high near 10. North northwest wind 17 to 24 km/h, with gusts as high as 33 km/h. Chance of precipitation is 40%. New rainfall amounts less than 0.5 cm possible."

US customary

"A chance of rain showers. Mostly cloudy, with a high near 50. North northwest wind 10 to 15 mph, with gusts as high as 21 mph. Chance of precipitation is 40%. New rainfall amounts less than a tenth of an inch possible."



 let package = Package(
   // name: "SquareNumber",
   platforms: [ .iOS(.v10), .macOS(.v10_12) ], // The `NationalWeatherService-Swift`repo has these constraints, so be sure to match
   // products: [ ],
   dependencies: [
     .package(url: "https://github.com/roblabs/NationalWeatherService-Swift.git", .exactItem("0.4.2-beta"))
   ],
   targets: [
     .target(
       // name:...
       dependencies: [
         .product(name: "NationalWeatherService", package: "NationalWeatherService-Swift"),
       ]
     ),
   ]
 )
roblabs commented 2 years ago

Looks like the tests are failing due to an environment variable.

I understand how its set in my local build, but how is it managed for the CI builds?

ualch9 commented 2 years ago

Looks like the tests are failing due to an environment variable.

I understand how its set in my local build, but how is it managed for the CI builds?

@roblabs AFAIK PRs don't seem to get access to a repo's secrets, even after my approval to run. Ill test this on my machine soon and manually approve and merge. thanks for your PR in advance :)

roblabs commented 2 years ago

Great, @ualch9. I added two tests for the Bellevue, WA area: one with a request for °C and one with a request for °F. I can't recall if GitHub actions return the .xctestResult Testing bundle, but your local tests should show those results.

Great repo!