Command-Line Unit and Currency Converter
Write a Swift command-line tool that converts between metric/imperial units and fetches live exchange rates for currency conversion from a public API. Learners practice Swift scripting, URLSession with async/await, and argument parsing.
- Estimate
- ~8h
- Steps
- 6
- Completed by
- 0
- Proposed by
- codeseed.app
Foundation · URLSession
Project roadmap
- 01
Set up a Swift executable package
~1hCreate a Swift package with an executable target for the CLI tool.
- 02
Implement unit conversion functions
~1.5hWrite functions converting between metric and imperial length, weight, and volume units.
- 03
Parse command-line arguments
~1.5hRead the conversion type and value from command-line arguments.
- 04
Fetch live exchange rates
~2hUse async/await with URLSession to fetch current exchange rates from a public API.
- 05
Format and print results
~1hPrint conversion results with appropriate rounding and unit labels.
- 06
Handle network errors
~1hGracefully handle network failures and invalid API responses.
Resources
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack