From 54950cfd7517678d0ef7c3db604f71b0c287b6e8 Mon Sep 17 00:00:00 2001 From: KIM CHANHEE <85754295+chanhihi@users.noreply.github.com> Date: Mon, 11 Mar 2024 20:33:55 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20=F0=9F=93=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..fe682b2 --- /dev/null +++ b/README.md @@ -0,0 +1,81 @@ +# Weather App + +This app uses the [OpenAPI](https://open-meteo.com/en/docs/geocoding-api) library. + +It also uses the first-party frameworks Charts, CoreLocation to serve clients + +It is responsive and components are laid out with the user experience in mind. + +This project allowed me to become a 'Contributor' to OpenMeteo/SDK. + +I didn't do much, but it gave me the experience of creating and resolving an issue. https://github.com/open-meteo/sdk/pull/66 + +
+ +## What I learned + +- [SwiftUI](https://developer.apple.com/documentation/swiftui/) +- [Chart](https://developer.apple.com/documentation/charts) +- [open-meteo Weather Library](https://github.com/open-meteo/sdk) +- [SwiftUI AutoLayout](https://developer.apple.com/documentation/swiftui/GeometryReader) +- Peer Soft Skill + +||| +|---|---| +|image|image| +|image|image| +|image|image| +|![Simulator Screen Recording - iPhone 15 - 2024-03-11 at 19 44 24](https://github.com/chanheki/mobileModule03/assets/85754295/35f09ded-4561-4a6c-b66e-97233e424705)| + +
+ +## A quick look at SWIFT code + +``` Swift +var body: some View { + Chart{ + ForEach(weeklyData) { series in + ForEach(series.temperatureData, id: \.day) { data in + LineMark( + x: .value("Day", data.day, unit: .day), + y: .value("Temperature", data.temperature) + ) + .foregroundStyle(by: .value("TemperatureType", series.temperatureType)) + .symbol(by: .value("TemperatureType", series.temperatureType)) + .interpolationMethod(.catmullRom) + } + } + + if let selectedDate { + RuleMark( + x: .value("Selected", selectedDate, unit: .day) + ) + .foregroundStyle(Color.gray.opacity(0.3)) + .zIndex(1) + .annotation( + position: .top, spacing: 0, + overflowResolution: .init( + x: .fit(to: .chart), + y: .disabled + ) + ) { + valueSelectionPopover + } + } + } + .chartForegroundStyleScale { colorTemperature[$0]! } + .chartSymbolScale([ + "Max Temperature": Circle().strokeBorder(lineWidth: 2), + "Min Temperature": Square().strokeBorder(lineWidth: 2) + ]) + .chartXAxis { + AxisMarks(values: .stride(by: .day)) { _ in + AxisTick() + AxisGridLine() + AxisValueLabel(format: .dateTime.weekday(.abbreviated), centered: true) + } + } + .chartXSelection(value: $rawSelectedDate) +} + +```