-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from yw22/feature/김영욱/친구목록
[친구 목록] MVVM-C, Clean Architecture 적용했습니다.
- Loading branch information
Showing
18 changed files
with
424 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
NearTalk/NearTalk/Application/DIContainer/FriendListDIContainer.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// FriendListDIContainer.swift | ||
// NearTalk | ||
// | ||
// Created by 김영욱 on 2022/11/21. | ||
// | ||
|
||
import UIKit | ||
|
||
final class FriendListDIContainer { | ||
|
||
// MARK: - Dependencies | ||
struct Dependencies { | ||
let firestoreService: FirestoreService | ||
let firebaseAuthService: FirebaseAuthService | ||
} | ||
|
||
private let dependencies: Dependencies | ||
|
||
// MARK: - Persistent Storage | ||
init(dependencies: Dependencies) { | ||
self.dependencies = dependencies | ||
} | ||
|
||
// MARK: - Services | ||
|
||
// MARK: - UseCases | ||
func makeFetchFriendListUseCase() -> FetchFriendListUseCase { | ||
return DefaultFetchFriendListUseCase(profileRepository: self.makeRepository()) | ||
} | ||
|
||
func makeProfileDetailUseCaseAble() -> ProfileDetailUseCaseAble { | ||
return ProfileDetailUseCase() | ||
} | ||
|
||
// MARK: - Repositories | ||
func makeRepository() -> ProfileRepository { | ||
return DefaultProfileRepository(firestoreService: dependencies.firestoreService, firebaseAuthService: dependencies.firebaseAuthService) | ||
} | ||
|
||
// MARK: - Friend Lsit | ||
func makeFriendListViewController(actions: FriendListViewModelActions) -> FriendListViewController { | ||
return FriendListViewController.create(with: self.makeFriendListViewModel(actions: actions)) | ||
} | ||
|
||
func makeFriendListViewModel(actions: FriendListViewModelActions) -> FriendListViewModel { | ||
return DefaultFriendListViewModel(useCase: self.makeFetchFriendListUseCase(), actions: actions) | ||
} | ||
|
||
// MARK: - Profile Detail | ||
// func makeProfileDetailViewController() -> ProfileDetailViewController { | ||
// return ProfileDetailViewController(viewModel: makeProfileDetailViewModel()) | ||
// } | ||
// | ||
// func makeProfileDetailViewModel() -> ProfileDetailViewModel { | ||
// return ProfileDetailViewModel(profileDetailUseCase: self.makeProfileDetailUseCaseAble(), profileDetailCoordinator: self.makeProfileDetailCoordinator(makeFriendListCoordinator)) | ||
// } | ||
|
||
// MARK: - Coordinator | ||
func makeFriendListCoordinator(navigationController: UINavigationController) -> FriendListCoordinator { | ||
return FriendListCoordinator(navigationController: navigationController, dependencies: self) | ||
} | ||
|
||
// func makeProfileDetailDIContainer() -> ProfileDetailDIContainer { | ||
// let dependencies = ProfileDetailDIContainer.Dependencies() | ||
// return ProfileDetailDICOntainer(dependencies: dependencies) | ||
// } | ||
} | ||
|
||
extension FriendListDIContainer: FriendListCoordinatorDependencies {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// Friends.swift | ||
// NearTalk | ||
// | ||
// Created by 김영욱 on 2022/11/21. | ||
// | ||
|
||
import Foundation | ||
|
||
struct Friend: Codable, Hashable { | ||
/// 유저 UUID | ||
var userID: String? | ||
var username: String? | ||
var statusMessage: String? | ||
var profileImagePath: String? | ||
} |
Oops, something went wrong.