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

[REFACTOR] ArticleCategory, Challenge, Bookmark Factory Pattern 적용(#143) #146

Merged
merged 4 commits into from
Oct 15, 2023

Conversation

kimscastle
Copy link
Contributor

[#143] REFACTOR : ArticleCategory, Challenge, Bookmark Factory Pattern 적용

🌱 작업한 내용

  • ArticleCategory관련 coordinator, viewcontroller에 factory pattern을 적용했습니다
  • Challenge관련 coordinator, viewcontroller에 factory pattern을 적용했습니다
  • Bookmark관련 coordinator, viewcontroller에 factory pattern을 적용했습니다

🌱 PR Point

  1. viewcontroller는 각각의 unique한 viewcontrollerable을 가지고 있고 해당interface는 coordinator(각각의 navigation interface type)와 데이터전달이 필요한 경우엔 해당 데이터를 추상화하고 있습니다
protocol BookmarkViewControllerable where Self: UIViewController {
    var coordinator: BookmarkNavigation? { get set }
}
  1. 각각의 coordinator는 unique한 factory interface를 가지고 있고 각각 필요한 viewcontrollerable타입을 return해줍니다
    • coordinator의 init에 factory의 구현체를 외부 주입해줍니다
protocol BookmarkFactory {
    func makeBookmarkViewController() -> BookmarkViewControllerable
}
  1. 구현체(impl)는 저장속성이 없고 메서드만 호출하면되기때문에 struct로 구현햇습니다
struct BookmarkFactoryImpl: BookmarkFactory {
    func makeBookmarkViewController() -> BookmarkViewControllerable {
        return BookmarkViewController(manager: BookmarkMangerImpl(bookmarkService: BookmarkServiceImpl(apiService: APIService())))
    }
}

📮 관련 이슈

@kimscastle kimscastle added 🦁의성 의성's ✨Feat 새로운 기능 구현 ♻️Refactoring 리펙터링 labels Oct 15, 2023
@kimscastle kimscastle added this to the 🦁1차 Refactor🦁 milestone Oct 15, 2023
@kimscastle kimscastle self-assigned this Oct 15, 2023
@kimscastle kimscastle merged commit 603b767 into main Oct 15, 2023
@kimscastle kimscastle deleted the refactor/#143-factoryPattern-uiskim22 branch October 17, 2023 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨Feat 새로운 기능 구현 ♻️Refactoring 리펙터링 🦁의성 의성's
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REFACTOR] ArticleCategory, Challenge, Bookmark Factory Pattern 적용
1 participant