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

🔀 :: [#128] Feature 모듈의 Interface 전체 분리 #194

Merged
merged 10 commits into from
Aug 30, 2023
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,7 @@ public extension MicroTargetPathConvertable where Self: RawRepresentable {
"\(self.rawValue)\(type.rawValue)"
}
}

// MARK: - For DI
extension ModulePaths.Feature: CaseIterable {}
extension ModulePaths.Domain: CaseIterable {}
35 changes: 10 additions & 25 deletions Projects/App/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,16 @@ let targets: [Target] = [
resources: ["Resources/**"],
entitlements: "Support/Dotori.entitlements",
scripts: scripts,
dependencies: [
.feature(target: .RootFeature),
.feature(target: .SplashFeature),
.feature(target: .SigninFeature),
.feature(target: .MainTabFeature),
.feature(target: .SignupFeature),
.feature(target: .RenewalPasswordFeature),
.feature(target: .ConfirmationDialogFeature),
.feature(target: .InputDialogFeature),
.feature(target: .FilterSelfStudyFeature),
.domain(target: .AuthDomain),
.domain(target: .UserDomain),
.domain(target: .SelfStudyDomain),
.domain(target: .MassageDomain),
.domain(target: .MealDomain),
.domain(target: .NoticeDomain),
.domain(target: .ViolationDomain),
.domain(target: .MusicDomain),
.core(target: .JwtStore),
.core(target: .KeyValueStore),
.core(target: .Networking),
.core(target: .Database),
.core(target: .Timer),
.target(name: "\(env.name)ShareExtension")
],
dependencies: ModulePaths.Feature.allCases.map { TargetDependency.feature(target: $0) }
+ ModulePaths.Domain.allCases.map { TargetDependency.domain(target: $0) }
+ [
.core(target: .JwtStore),
.core(target: .KeyValueStore),
.core(target: .Networking),
.core(target: .Database),
.core(target: .Timer),
.target(name: "\(env.name)ShareExtension")
],
settings: .settings(
base: env.baseSetting
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import BaseFeature
import BaseFeatureInterface
import UIKit

public protocol ConfirmationDialogFactory {
func makeViewController(
title: String,
description: String,
confirmAction: @escaping () async -> Void
) -> any StoredViewControllable
) -> any RoutedViewControllable
}
6 changes: 5 additions & 1 deletion Projects/Feature/ConfirmationDialogFeature/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ import ProjectDescriptionHelpers
let project = Project.module(
name: ModulePaths.Feature.ConfirmationDialogFeature.rawValue,
targets: [
.interface(module: .feature(.ConfirmationDialogFeature), dependencies: [
.feature(target: .BaseFeature, type: .interface)
]),
.implements(
module: .feature(.ConfirmationDialogFeature),
dependencies: [
.feature(target: .BaseFeature)
.feature(target: .BaseFeature),
.feature(target: .ConfirmationDialogFeature, type: .interface)
]
),
.tests(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import ConfirmationDialogFeatureInterface
import Swinject

public final class ConfirmationDialogAssembly: Assembly {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import BaseFeature
import BaseFeatureInterface
import ConfirmationDialogFeatureInterface
import UIKit

final class ConfirmationDialogFactoryImpl: ConfirmationDialogFactory {
func makeViewController(
title: String,
description: String,
confirmAction: @escaping () async -> Void
) -> any StoredViewControllable {
) -> any RoutedViewControllable {
let store = ConfirmationDialogStore(confirmAction: confirmAction)
return ConfirmationDialogViewController(
title: title,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import BaseFeatureInterface
import UIKit

public protocol DetailNoticeFactory {
func makeViewController(noticeID: Int) -> any RoutedViewControllable
}
4 changes: 4 additions & 0 deletions Projects/Feature/DetailNoticeFeature/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ import ProjectDescriptionHelpers
let project = Project.module(
name: ModulePaths.Feature.DetailNoticeFeature.rawValue,
targets: [
.interface(module: .feature(.DetailNoticeFeature), dependencies: [
.feature(target: .BaseFeature, type: .interface)
]),
.implements(module: .feature(.DetailNoticeFeature), dependencies: [
.feature(target: .BaseFeature),
.feature(target: .DetailNoticeFeature, type: .interface),
.domain(target: .NoticeDomain, type: .interface),
.domain(target: .UserDomain, type: .interface)
]),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import DetailNoticeFeatureInterface
import NoticeDomainInterface
import Swinject
import UserDomainInterface
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import BaseFeature
import BaseFeatureInterface
import DetailNoticeFeatureInterface
import NoticeDomainInterface
import UIKit
import UserDomainInterface
Expand All @@ -18,7 +20,7 @@ struct DetailNoticeFactoryImpl: DetailNoticeFactory {
self.loadCurrentUserRoleUseCase = loadCurrentUserRoleUseCase
}

func makeViewController(noticeID: Int) -> any StoredViewControllable {
func makeViewController(noticeID: Int) -> any RoutedViewControllable {
let store = DetailNoticeStore(
noticeID: noticeID,
fetchNoticeUseCase: fetchNoticeUseCase,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import BaseFeatureInterface
import Moordinator
import UIKit

Expand Down
8 changes: 6 additions & 2 deletions Projects/Feature/HomeFeature/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ import ProjectDescriptionHelpers
let project = Project.module(
name: ModulePaths.Feature.HomeFeature.rawValue,
targets: [
.interface(module: .feature(.HomeFeature), dependencies: [
.feature(target: .BaseFeature, type: .interface)
]),
.implements(
module: .feature(.HomeFeature),
dependencies: [
.feature(target: .BaseFeature),
.feature(target: .ConfirmationDialogFeature),
.feature(target: .MyViolationListFeature),
.feature(target: .HomeFeature, type: .interface),
.feature(target: .ConfirmationDialogFeature, type: .interface),
.feature(target: .MyViolationListFeature, type: .interface),
.feature(target: .InputDialogFeature, type: .interface),
.domain(target: .SelfStudyDomain, type: .interface),
.domain(target: .MassageDomain, type: .interface),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import ConfirmationDialogFeature
import ConfirmationDialogFeatureInterface
import HomeFeatureInterface
import InputDialogFeatureInterface
import MassageDomainInterface
import MealDomainInterface
import Moordinator
import MyViolationListFeature
import MyViolationListFeatureInterface
import SelfStudyDomainInterface
import Swinject
import TimerInterface
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import ConfirmationDialogFeature
import ConfirmationDialogFeatureInterface
import HomeFeatureInterface
import InputDialogFeatureInterface
import MassageDomainInterface
import MealDomainInterface
import Moordinator
import MyViolationListFeature
import MyViolationListFeatureInterface
import SelfStudyDomainInterface
import TimerInterface
import UserDomainInterface
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import BaseFeature
import BaseFeatureInterface
import ConfirmationDialogFeature
import ConfirmationDialogFeatureInterface
import DWebKit
import InputDialogFeatureInterface
import Localization
import Moordinator
import MyViolationListFeature
import MyViolationListFeatureInterface
import TimerInterface
import UIKit
import UIKitUtil
Expand Down Expand Up @@ -90,7 +90,7 @@ private extension HomeMoordinator {
self.rootVC.topViewController?.modalPresent(viewController)
return .one(.contribute(
withNextPresentable: viewController,
withNextRouter: viewController.store
withNextRouter: viewController.router
))
}

Expand All @@ -108,7 +108,7 @@ private extension HomeMoordinator {
return .one(
.contribute(
withNextPresentable: viewController,
withNextRouter: viewController.store
withNextRouter: viewController.router
)
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import BaseFeatureInterface
import Moordinator

public protocol MainFactory {
Expand Down
14 changes: 9 additions & 5 deletions Projects/Feature/MainTabFeature/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ import ProjectDescriptionHelpers
let project = Project.module(
name: ModulePaths.Feature.MainTabFeature.rawValue,
targets: [
.interface(module: .feature(.MainTabFeature), dependencies: [
.feature(target: .BaseFeature, type: .interface)
]),
.implements(module: .feature(.MainTabFeature), dependencies: [
.feature(target: .BaseFeature),
.feature(target: .HomeFeature),
.feature(target: .NoticeFeature),
.feature(target: .SelfStudyFeature),
.feature(target: .MassageFeature),
.feature(target: .MusicFeature)
.feature(target: .MainTabFeature, type: .interface),
.feature(target: .HomeFeature, type: .interface),
.feature(target: .NoticeFeature, type: .interface),
.feature(target: .SelfStudyFeature, type: .interface),
.feature(target: .MassageFeature, type: .interface),
.feature(target: .MusicFeature, type: .interface)
]),
.tests(module: .feature(.MainTabFeature), dependencies: [
.feature(target: .MainTabFeature)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import HomeFeature
import MassageFeature
import MusicFeature
import NoticeFeature
import SelfStudyFeature
import HomeFeatureInterface
import MainTabFeatureInterface
import MassageFeatureInterface
import MusicFeatureInterface
import NoticeFeatureInterface
import SelfStudyFeatureInterface
import Swinject

public final class MainAssembly: Assembly {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import HomeFeature
import MassageFeature
import HomeFeatureInterface
import MainTabFeatureInterface
import MassageFeatureInterface
import Moordinator
import MusicFeature
import NoticeFeature
import SelfStudyFeature
import MusicFeatureInterface
import NoticeFeatureInterface
import SelfStudyFeatureInterface

struct MainFactoryImpl: MainFactory {
private let homeFactory: any HomeFactory
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import BaseFeature
import HomeFeature
import MassageFeature
import HomeFeatureInterface
import MassageFeatureInterface
import Moordinator
import MusicFeature
import NoticeFeature
import SelfStudyFeature
import MusicFeatureInterface
import NoticeFeatureInterface
import SelfStudyFeatureInterface
import UIKit

final class MainTabMoordinator: Moordinator {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import BaseFeatureInterface
import Moordinator

public protocol MassageFactory {
Expand Down
4 changes: 4 additions & 0 deletions Projects/Feature/MassageFeature/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ import ProjectDescriptionHelpers
let project = Project.module(
name: ModulePaths.Feature.MassageFeature.rawValue,
targets: [
.interface(module: .feature(.MassageFeature), dependencies: [
.feature(target: .BaseFeature, type: .interface)
]),
.implements(module: .feature(.MassageFeature), dependencies: [
.feature(target: .BaseFeature),
.feature(target: .MassageFeature, type: .interface),
.domain(target: .MassageDomain, type: .interface),
.domain(target: .UserDomain, type: .interface)
]),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import MassageDomainInterface
import MassageFeatureInterface
import Swinject
import UserDomainInterface

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import MassageDomainInterface
import MassageFeatureInterface
import Moordinator
import UserDomainInterface

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import BaseFeatureInterface
import Moordinator

public protocol MusicFactory {
Expand Down
6 changes: 5 additions & 1 deletion Projects/Feature/MusicFeature/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ import ProjectDescriptionHelpers
let project = Project.module(
name: ModulePaths.Feature.MusicFeature.rawValue,
targets: [
.interface(module: .feature(.MusicFeature), dependencies: [
.feature(target: .BaseFeature, type: .interface)
]),
.implements(module: .feature(.MusicFeature), dependencies: [
.feature(target: .BaseFeature),
.feature(target: .ProposeMusicFeature),
.feature(target: .MusicFeature, type: .interface),
.feature(target: .ProposeMusicFeature, type: .interface),
.domain(target: .MusicDomain, type: .interface),
.domain(target: .UserDomain, type: .interface)
]),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import MusicDomainInterface
import ProposeMusicFeature
import MusicFeatureInterface
import ProposeMusicFeatureInterface
import Swinject
import UserDomainInterface

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Moordinator
import MusicDomainInterface
import MusicFeatureInterface
import ProposeMusicFeature
import ProposeMusicFeatureInterface
import UserDomainInterface

struct MusicFactoryImpl: MusicFactory {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import BaseFeature
import Localization
import Moordinator
import ProposeMusicFeature
import ProposeMusicFeatureInterface
import UIKit
import UIKitUtil

Expand Down Expand Up @@ -85,7 +85,7 @@ private extension MusicMoordinator {
return .one(
.contribute(
withNextPresentable: viewController,
withNextRouter: viewController.store
withNextRouter: viewController.router
)
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import BaseFeatureInterface

public protocol MyViolationListFactory {
func makeViewController() -> any RoutedViewControllable
}
Loading
Loading