Skip to content

Conversation

@OpenBible3438
Copy link

@OpenBible3438 OpenBible3438 commented Jun 11, 2023

작업 목록

  • ToDoList, Input, Detail 화면 UI 구성
  • DatePicker() 날짜 선택
  • MKMapView() 입력한 주소를 지도에 출력
  • MKPointAnnotation()을 사용하여 지도 핀 꽂기

추가할 작업 목록

  • TDD 적용
  • ToDoList 완료, 비완료 구분

학습 키워드

  • TableView, DatePicker, MapKit(MKMapView, MKPointAnnotation)

고민과 해결

DatePicker

다양한 스타일을 선택할 수 있었지만 레퍼런스와 비슷하게 한국식으로만 바꾸었습니다.

�MVC

이번에도 ChatGPT에게 문의하여 지난번과과는 다른 방식으로 폴더 구성을 했습니다.

  • Project
    • Sources
      • AppDelegate.swift
      • SceneDelegate.swift
      • Models
        • ...
      • Views
        • ...
      • Controllers
        • ...
      • Helpers
        • ...
    • Resources
      • Assets.xcassets
      • ...
    • Supporting Files
      • Info.plist
      • ...
    • Tests
      • ...

MapKit

  • 특정 건물 이름이나 장소명이 아닌 정확한 주소를 작성하는 건 사용자 측면에서 불편한 것 같습니다..
  • 지도에 주소를 표현할 때 너무 허전한 것 같아서 핀(Annotation) 설정을 했습니다.
  • 입력한 주소를 좌표값(coordinate)을 구하여 MapView에 출력하고 Annotation은 coordinate를 통해서 위도와 경도값을 추출하여 사용할 수 있습니다.
if let coordinate = location?.coordinate {
    // 위치
    let region = MKCoordinateRegion(center: coordinate, latitudinalMeters: 1000, longitudinalMeters: 1000)
                    
    // 핀(Annotation)
    let annotation = MKPointAnnotation()
    annotation.coordinate = CLLocationCoordinate2D(latitude: coordinate.latitude, longitude: coordinate.longitude)
    annotation.title = self.data?.title
    annotation.subtitle = self.data?.description
                    
    self.mapView.addAnnotation(annotation)
    self.mapView.setRegion(region, animated: true)
}

느낀점

추가할 수 있는 기능들이 많아서 좀 더 발전시키고 싶은 욕심이 조금 들었고,
TDD 공부를 해야될 것 같습니다.

- MainVC, InputVC 화면 UI
- InputVC 데이터 추가 기능 개발
- MainVC TableView 데이터 출력 기능 개발
ChatGPT의 추천대로 폴더 구조 변경

- Project
  - Sources
    - AppDelegate.swift
    - SceneDelegate.swift
    - Models
      - ...
    - Views
      - ...
    - Controllers
      - ...
    - Helpers
      - ...
  - Resources
    - Assets.xcassets
    - ...
  - Supporting Files
    - Info.plist
    - ...
  - Tests
    - ...
- MapView 적용
- 추가한 주소를 경도와 위도로 변환해서 MapView 적용
- MapView 표시할 때 Annotation으로 title, description 함께 출력
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.

1 participant