Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge :: Base 세팅 #41

Merged
merged 26 commits into from
Oct 14, 2022
Merged

merge :: Base 세팅 #41

merged 26 commits into from
Oct 14, 2022

Conversation

baekteun
Copy link
Member

@baekteun baekteun commented Oct 13, 2022

개요

기본적인 Base 세팅 좀 했습니다.

작업사항

  • BaseViewModel
  • DmsAPI
  • BaseRemoteDataSource

사용방법

  • BaseViewModel
    isErrorOcuured, isLoading, errorMessage는 BaseViewModel을 상속받는 모든 ViewModel이 사용가능.

addCancellable은 Publisher가 sink이후 cancellable에 추가해야 동작할 수 있기 때문에 코드 중복이 일어날 가능성이 높아 추가한 method입니다.

...
private func signin() {
  addCancellable(signinUseCase.execute(email: "", password: "")) { [weak self] _ in
    self?.isSuccessSignin = true
  } onReceiveFailure: { err in { 
    print(err.localizedDescription)
  }
}
...

  • DmsAPI
public enum TestAPI: DmsAPI {
    case test1
    case test2

    var domain: DmsDomain { .test }

    var urlPath: String { "/" }

    var method: Moya.Method { .get }

    var task: Moya.Task { .requestPlain }

    var jwtTokenType: JwtTokenType { .none }

    var errorMap: [Int: DmsError] { [:] }
}

  • BaseRemoteDataSource
public final class RemoteTestDataSourceImpl: BaseRemoteDataSource<TestAPI>, RemoteTestDataSource {
    func test() -> AnyPublisher<String, Error> {
        return request(.test, dto: TestResponseDTO.self)
                      .toDomain()
    }
}

@baekteun baekteun added the ✨feat 새로운 기능을 추가 할 경우 label Oct 13, 2022
@baekteun baekteun requested a review from limsaehyun October 13, 2022 10:20
@baekteun baekteun self-assigned this Oct 13, 2022
@baekteun baekteun linked an issue Oct 13, 2022 that may be closed by this pull request

public extension DmsAPI {
var baseURL: URL {
URL(string: "https://google.com")!
Copy link
Member

Choose a reason for hiding this comment

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

DMS 도메인이 없어 가상의 도메인을 넣어둔건가요?
BaseURL이 추후에 수정될 수 있게
TODO를 붙여주면 좋을 것 같아요.

Copy link
Member Author

Choose a reason for hiding this comment

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

좋은 의견 감사합니다!

@limsaehyun
Copy link
Member

image

1. 첫 번째 커밋 메세지가 오류가 있어요. ';:' 2. 이모티콘과 영문 커밋 메시지의 통일이 필요해 보여요.

@baekteun
Copy link
Member Author

image
  1. 첫 번째 커밋 메세지가 오류가 있어요. ';:' 2. 이모티콘과 영문 커밋 메시지의 통일이 필요해 보여요.

습관적으로 gitmoji를 써버렸네요 ㅜㅜ 앞으로는 머리라는 것을 써보도록 하겠습니다 🫡

@limsaehyun limsaehyun closed this Oct 14, 2022
@limsaehyun limsaehyun reopened this Oct 14, 2022
@limsaehyun
Copy link
Member

헉 실수로 reopen 했네요 죄송합니다 ㅜ.ㅜ
리뷰 반영 감사해요 :D

@baekteun
Copy link
Member Author

헉 실수로 reopen 했네요 죄송합니다 ㅜ.ㅜ
리뷰 반영 감사해요 :D

히히

Copy link
Member

@limsaehyun limsaehyun left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@kimdaehee0824 kimdaehee0824 left a comment

Choose a reason for hiding this comment

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

헉 늦게 봤네요 죄송함다

@baekteun baekteun merged commit 2df96aa into develop Oct 14, 2022
@baekteun baekteun deleted the 39-base-settings branch October 14, 2022 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨feat 새로운 기능을 추가 할 경우
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Base 세팅
4 participants