Skip to content

[1주차 트러블 슈팅] 홍성준 (네트워크)

SungJun Hong edited this page Dec 13, 2023 · 1 revision

🖼️ 배경

🫠 트러블

  • Moya/Alamofire 등 네트워크 라이브러리를 사용하지 못하는 조건
  • 어떻게 하면 네트워크를 잘 활용할 수 있을까?

✅ 솔루션

  • Network 프로토콜을 생성하였음
  • Network 구현체는 URLSession을 주입 받도록 하였음
  • URLProtocol을 활용하여 네트워크 모킹을 활용하였음
    • 생성 메소드를 static 하게 만들어 Boolean 값 하나로 쉽게 모킹할 수 있는 구조로 만들었음
    • 모킹을 하게 되면 로컬에 있는 네트워크 응답을 JSON 파일로 대체하게 되어 서버가 중단이 되어도 지속적으로 개발할 수 있는 환경을 구축하였음
static func generateNetworkProvider(isDebug: Bool, protocols: [AnyClass]) -> Network {
    if isDebug {
        let configuration = URLSessionConfiguration.ephemeral
        configuration.protocolClasses = protocols
        return NetworkProvider(session: URLSession(configuration: configuration), signOutService: SignoutService.shared)
    } else {
        return NetworkProvider(session: URLSession.shared, signOutService: SignoutService.shared)
    }
}
let searchNetworkProvider = AppRootComponent.generateNetworkProvider(isDebug: false, protocols: [SearchURLProtocol.self])
self.searchUseCase = SearchUseCase(
    repository: SearchRepository(session: searchNetworkProvider),
    locationService: locationService,
    clusteringService: ClusteringService()
)

🔥 HeatPick

🔨 프로젝트 소개

🫠 트러블 슈팅

1주차

2주차

3주차

4주차

5주차

🤔 기획 회의록

🤷🏻 의사 결정록

🍎 iOS

🌐 Backend

🎯 주차별 목표

🏃🏻 데일리 스크럼

1주차

2주차

3주차

4주차

5주차

6주차

🙇🏻 멘토링 일지

👀 프로젝트 현황 공유

🙋🏻 팀 회고

💪 개인 회고

1주차

2주차

3주차

4주차

5주차

📇 템플릿

Clone this wiki locally