Skip to content

[Feat] 광진구 버스 종합, 위치 기반 버스 정류장 검색 기능 구현#1

Merged
ParkSeongGeun merged 8 commits intodevfrom
feat/PositionCheck
Sep 30, 2025
Merged

[Feat] 광진구 버스 종합, 위치 기반 버스 정류장 검색 기능 구현#1
ParkSeongGeun merged 8 commits intodevfrom
feat/PositionCheck

Conversation

@ParkSeongGeun
Copy link
Copy Markdown
Contributor

@ParkSeongGeun ParkSeongGeun commented Sep 30, 2025

개요

사용자의 현재 위치를 기반으로 가장 가까운 버스 정류장을 찾고, 해당 정류장을 지나는 버스 노선 정보를 제공하는 기능을 구현했습니다.

수정사항

1. 모델 추가

  • BusStop: 버스 정류장 정보를 담는 기본 모델
  • StopWithRoutes: 정류장과 해당 정류장을 지나는 버스 노선 정보를 함께 관리하는 모델

2. 매니저 구현

  • LocationManager: 사용자의 위치 권한 요청 및 실시간 위치 추적 기능
    • 위치 업데이트 콜백 지원
    • 위치 새로고침 기능
  • BusStopManager: CSV 데이터 기반 정류장 검색 및 관리
    • 사용자 위치 기반 가장 가까운 정류장 검색
    • 정류장별 버스 노선 정보 제공
  • APIManager: 향후 API 연동을 위한 기본 구조

3. 데이터 추가

  • bus_route_stops.csv: 버스 정류장 및 노선 데이터 (209개 항목)

4. 테스트 코드 작성

  • LocationManagerTests: 위치 관리 기능 테스트 (9개 테스트)
    • 초기화, 위치 업데이트, 콜백, refresh 등
  • BusStopManagerTests: 정류장 검색 기능 테스트 (6개 테스트)
    • 정류장 검색, 로딩 상태, 성능 측정 등
  • 한글 기반 테스트 메서드명 컨벤션 적용

5. 프로젝트 설정

  • 유닛 테스트 타겟 ComfortableMoveTest 추가
  • .gitignore 추가 (macOS, Xcode 관련 파일)

테스트 커버리지

  • LocationManager: 위치 추적, 콜백, 에러 처리 등
  • BusStopManager: 정류장 검색, 캐싱, 성능 등

Summary by CodeRabbit

  • New Features

    • App can detect your location and identify the nearest bus stop with its routes.
    • Improves responsiveness with clear loading indicators during nearest-stop searches.
  • Tests

    • Added a new test target with comprehensive unit tests for location updates and nearest-stop logic, including performance checks.
  • Chores

    • Added a .gitignore to exclude common macOS, Xcode, SwiftPM, and CocoaPods files from version control.

@ParkSeongGeun ParkSeongGeun self-assigned this Sep 30, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Sep 30, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Adds .gitignore, introduces core data/models and managers for bus stops and location, scaffolds an API manager, creates a new Xcode unit-test target, and adds comprehensive tests for BusStopManager and LocationManager. BusStopManager loads/parses CSV, groups stops, and computes nearest stop asynchronously with published state updates.

Changes

Cohort / File(s) Summary of Changes
Repository ignore rules
ComfortableMove/.gitignore
Adds ignore patterns for macOS, Xcode, SwiftPM, and CocoaPods artifacts.
Xcode project updates
ComfortableMove/ComfortableMove.xcodeproj/project.pbxproj
Adds ComfortableMoveTest unit-test target with build phases, configs, dependencies, groups, and product references.
Managers
ComfortableMove/ComfortableMove/Core/Manager/APIManager.swift, ComfortableMove/ComfortableMove/Core/Manager/BusStopManager.swift, ComfortableMove/ComfortableMove/Core/Manager/LocationManager.swift
New files. APIManager scaffold. BusStopManager loads/parses CSV, groups stops by location, and finds nearest stop asynchronously with Published state. LocationManager handles permission, location updates, one-shot callback, and refresh.
Models
ComfortableMove/ComfortableMove/Core/Model/BusStop.swift, ComfortableMove/ComfortableMove/Core/Model/StopWithRoutes.swift
Adds BusStop (Codable, Identifiable) with mapping to CSV/JSON keys and distance method; adds StopWithRoutes (Identifiable, Equatable) bundling stop and routes.
Unit tests
ComfortableMove/ComfortableMoveTest/BusStopManagerTests.swift, ComfortableMove/ComfortableMoveTest/LocationManagerTests.swift
Adds tests covering BusStopManager nearest-stop logic, loading state, determinism, and performance; adds LocationManager tests for callback behavior, state updates, refresh, and error handling.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant UI
  participant BusStopManager
  participant FileSystem as CSV File
  participant BG as Background Thread
  participant Main as Main Thread

  User->>UI: Request nearest stop
  UI->>BusStopManager: findNearestStop(userLocation)
  alt First use (no data)
    BusStopManager->>FileSystem: Load CSV (primary/fallback path)
    FileSystem-->>BusStopManager: Rows
    BusStopManager->>BusStopManager: Parse + Group stops
  end
  BusStopManager->>BG: Compute nearest among groups
  BG-->>BusStopManager: Nearest stop + routes
  BusStopManager->>Main: Update isLoading=false, nearestStop
  Main-->>UI: Render nearest stop
  note over BusStopManager,BG: isLoading=true during async search
Loading
sequenceDiagram
  autonumber
  actor User
  participant App
  participant LocationManager
  participant CoreLocation as CLLocationManager

  User->>App: Request location
  App->>LocationManager: requestPermission()
  LocationManager->>CoreLocation: requestWhenInUseAuthorization()
  CoreLocation-->>LocationManager: Authorization status
  alt Authorized
    LocationManager->>CoreLocation: startUpdatingLocation()
    CoreLocation-->>LocationManager: didUpdateLocations([CLLocation])
    LocationManager->>App: onLocationUpdate(first fix)
    LocationManager->>CoreLocation: stopUpdatingLocation()
  else Denied/Restricted
    LocationManager->>App: showPermissionAlert=true
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Poem

I hop through routes and cozy stops,
Sniffing CSVs with whisker pops.
A compass twitch, the nearest found—
Thump-thump logs on fertile ground.
With tests in tow, I bound with cheer—
Carrot-green builds, all clear, all clear! 🥕✨

Pre-merge checks and finishing touches and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 48.39% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The provided title “[Feat] 광진구 버스 종합, 위치 기반 버스 정류장 검색 기능 구현” clearly conveys the main addition of a location-based bus stop search feature for the Gwangjin-gu bus data, matching the PR’s core objectives around BusStopManager, LocationManager, and related models and tests. It is concise and specific, enabling reviewers to immediately understand the primary change without superfluous detail. The use of “[Feat]” aligns with common commit conventions and sets appropriate context for the nature of the work.

Comment @coderabbitai help to get the list of available commands and usage tips.

@ParkSeongGeun ParkSeongGeun changed the base branch from main to dev September 30, 2025 03:57
@ParkSeongGeun ParkSeongGeun merged commit 83c10c7 into dev Sep 30, 2025
2 checks passed
@ParkSeongGeun ParkSeongGeun deleted the feat/PositionCheck branch September 30, 2025 04:49
Copy link
Copy Markdown

@junghyungo junghyungo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants