Skip to content

Commit

Permalink
Merge pull request #57 from GSM-MSG/44-information-page-ui
Browse files Browse the repository at this point in the history
🔀 :: 정보입력 페이지 기반 다져놓기
  • Loading branch information
baekteun authored May 14, 2023
2 parents 23ad2a6 + 0372ea6 commit 8670108
Show file tree
Hide file tree
Showing 67 changed files with 661 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,62 @@ public extension TargetDependency {
}

public extension TargetDependency.Feature {
static let InputLanguageInfoFeatureInterface = TargetDependency.project(
target: ModulePaths.Feature.InputLanguageInfoFeature.targetName(type: .interface),
path: .relativeToFeature(ModulePaths.Feature.InputLanguageInfoFeature.rawValue)
)
static let InputLanguageInfoFeature = TargetDependency.project(
target: ModulePaths.Feature.InputLanguageInfoFeature.targetName(type: .sources),
path: .relativeToFeature(ModulePaths.Feature.InputLanguageInfoFeature.rawValue)
)
static let InputCertificateInfoFeatureInterface = TargetDependency.project(
target: ModulePaths.Feature.InputCertificateInfoFeature.targetName(type: .interface),
path: .relativeToFeature(ModulePaths.Feature.InputCertificateInfoFeature.rawValue)
)
static let InputCertificateInfoFeature = TargetDependency.project(
target: ModulePaths.Feature.InputCertificateInfoFeature.targetName(type: .sources),
path: .relativeToFeature(ModulePaths.Feature.InputCertificateInfoFeature.rawValue)
)
static let InputMilitaryInfoFeatureInterface = TargetDependency.project(
target: ModulePaths.Feature.InputMilitaryInfoFeature.targetName(type: .interface),
path: .relativeToFeature(ModulePaths.Feature.InputMilitaryInfoFeature.rawValue)
)
static let InputMilitaryInfoFeature = TargetDependency.project(
target: ModulePaths.Feature.InputMilitaryInfoFeature.targetName(type: .sources),
path: .relativeToFeature(ModulePaths.Feature.InputMilitaryInfoFeature.rawValue)
)
static let InputWorkInfoFeatureInterface = TargetDependency.project(
target: ModulePaths.Feature.InputWorkInfoFeature.targetName(type: .interface),
path: .relativeToFeature(ModulePaths.Feature.InputWorkInfoFeature.rawValue)
)
static let InputWorkInfoFeature = TargetDependency.project(
target: ModulePaths.Feature.InputWorkInfoFeature.targetName(type: .sources),
path: .relativeToFeature(ModulePaths.Feature.InputWorkInfoFeature.rawValue)
)
static let InputSchoolLifeInfoFeatureInterface = TargetDependency.project(
target: ModulePaths.Feature.InputSchoolLifeInfoFeature.targetName(type: .interface),
path: .relativeToFeature(ModulePaths.Feature.InputSchoolLifeInfoFeature.rawValue)
)
static let InputSchoolLifeInfoFeature = TargetDependency.project(
target: ModulePaths.Feature.InputSchoolLifeInfoFeature.targetName(type: .sources),
path: .relativeToFeature(ModulePaths.Feature.InputSchoolLifeInfoFeature.rawValue)
)
static let InputProfileInfoFeatureInterface = TargetDependency.project(
target: ModulePaths.Feature.InputProfileInfoFeature.targetName(type: .interface),
path: .relativeToFeature(ModulePaths.Feature.InputProfileInfoFeature.rawValue)
)
static let InputProfileInfoFeature = TargetDependency.project(
target: ModulePaths.Feature.InputProfileInfoFeature.targetName(type: .sources),
path: .relativeToFeature(ModulePaths.Feature.InputProfileInfoFeature.rawValue)
)
static let InputInformationFeatureInterface = TargetDependency.project(
target: ModulePaths.Feature.InputInformationFeature.targetName(type: .interface),
path: .relativeToFeature(ModulePaths.Feature.InputInformationFeature.rawValue)
)
static let InputInformationFeature = TargetDependency.project(
target: ModulePaths.Feature.InputInformationFeature.targetName(type: .sources),
path: .relativeToFeature(ModulePaths.Feature.InputInformationFeature.rawValue)
)
static let SigninFeatureInterface = TargetDependency.project(
target: ModulePaths.Feature.SigninFeature.targetName(type: .interface),
path: .relativeToFeature(ModulePaths.Feature.SigninFeature.rawValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ public enum ModulePaths {

public extension ModulePaths {
enum Feature: String {
case InputLanguageInfoFeature
case InputCertificateInfoFeature
case InputMilitaryInfoFeature
case InputWorkInfoFeature
case InputSchoolLifeInfoFeature
case InputProfileInfoFeature
case InputInformationFeature
case SigninFeature
case BaseFeature

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import Combine
import SwiftUI
import UIKit

struct SMSBackButtonModifier: ViewModifier {
let dismiss: DismissAction
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import SwiftUI

public protocol InputCertificateInfoBuildable {
associatedtype ViewType: View
func makeView() -> ViewType
}
12 changes: 12 additions & 0 deletions Projects/Feature/InputCertificateInfoFeature/Project.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import ProjectDescription
import ProjectDescriptionHelpers
import DependencyPlugin

let project = Project.makeModule(
name: ModulePaths.Feature.InputCertificateInfoFeature.rawValue,
product: .staticLibrary,
targets: [.interface, .unitTest],
internalDependencies: [
.Feature.BaseFeature
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import BaseFeature
import InputCertificateInfoFeatureInterface
import NeedleFoundation
import SwiftUI

public protocol InputCertificateInfoDependency: Dependency {}

public final class InputCertificateInfoComponent:
Component<InputCertificateInfoDependency>,
InputCertificateInfoBuildable {

public func makeView() -> some View {
EmptyView()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Foundation

final class InputCertificateInfoIntent: InputCetrificateInfoIntentProtocol {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Foundation

protocol InputCertificateInfoIntentProtocol {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

final class InputCertificateInfoModel: ObservableObject, InputCertificateInfoStateProtocol {}

extension InputCertificateInfoModel: InputCertificateInfoActionProtocol {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

protocol InputCertificateInfoStateProtocol {}

protocol InputCertificateInfoActionProtocol: AnyObject {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import BaseFeature
import SwiftUI

struct InputCertificateInfoView: View {
@StateObject var container: MVIContainer<InputCertificateInfoIntentProtocol, InputCertificateInfoStateProtocol>
var intent: any InputCertificateInfoIntentProtocol { container.intent }
var state: any InputCertificateInfoStateProtocol { container.model }

var body: some View {
Text("Hello, World!")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import XCTest

final class InputCertificateInfoFeatureTests: XCTestCase {
override func setUpWithError() throws {}

override func tearDownWithError() throws {}

func testExample() {
XCTAssertEqual(1, 1)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import SwiftUI

public protocol InputInformationBuildable {
associatedtype ViewType: View
func makeView() -> ViewType
}
18 changes: 18 additions & 0 deletions Projects/Feature/InputInformationFeature/Project.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import ProjectDescription
import ProjectDescriptionHelpers
import DependencyPlugin

let project = Project.makeModule(
name: ModulePaths.Feature.InputInformationFeature.rawValue,
product: .staticLibrary,
targets: [.interface, .unitTest],
internalDependencies: [
.Feature.BaseFeature,
.Feature.InputProfileInfoFeatureInterface,
.Feature.InputSchoolLifeInfoFeatureInterface,
.Feature.InputWorkInfoFeatureInterface,
.Feature.InputMilitaryInfoFeatureInterface,
.Feature.InputCertificateInfoFeatureInterface,
.Feature.InputLanguageInfoFeatureInterface
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import BaseFeature
import InputInformationFeatureInterface
import NeedleFoundation
import SwiftUI

public protocol InputInformationDependency: Dependency {}

public final class InputInformationComponent:
Component<InputInformationDependency>,
InputInformationBuildable {

public func makeView() -> some View {
let model = InputInformationModel()
let intent = InputInformationIntent(model: model)
let container = MVIContainer(
intent: intent as InputInformationIntentProtocol,
model: model as InputInformationStateProtocol,
modelChangePublisher: model.objectWillChange
)
return InputInformationView(container: container)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Foundation

final class InputInformationIntent: InputInformationIntentProtocol {
private weak var model: (any InputInformationActionProtocol)?

init(model: any InputInformationActionProtocol) {
self.model = model
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Foundation

protocol InputInformationIntentProtocol {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Foundation

final class InputInformationModel: ObservableObject, InputInformationStateProtocol {
@Published var phase: InformationPhase = .profile
}

extension InputInformationModel: InputInformationActionProtocol {
func prevButtonDidTap() {
guard let currentIndex = InformationPhase.allCases.firstIndex(of: phase),
currentIndex > 1
else { return }
phase = InformationPhase.allCases[currentIndex - 1]
}

func nextButtonDidTap() {
guard let currentIndex = InformationPhase.allCases.firstIndex(of: phase),
currentIndex < InformationPhase.allCases.count - 1
else { return }
phase = InformationPhase.allCases[currentIndex + 1]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Foundation

enum InformationPhase: CaseIterable {
case profile
case school
case workCondition
case military
case certification
case language
}

protocol InputInformationStateProtocol {
var phase: InformationPhase { get }
}

protocol InputInformationActionProtocol: AnyObject {
func prevButtonDidTap()
func nextButtonDidTap()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import BaseFeature
import SwiftUI

struct InputInformationView: View {
@StateObject var container: MVIContainer<InputInformationIntentProtocol, InputInformationStateProtocol>
var intent: any InputInformationIntentProtocol { container.intent }
var state: any InputInformationStateProtocol { container.model }

var body: some View {
InputInformationPageWrapView(
selection: Binding(
get: { state.phase },
set: { _ in }
)
) {
Text("a")
.tag(InformationPhase.profile)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import SwiftUI

struct InputInformationPageWrapView<Selection: Hashable, Content: View>: View {
@Binding var selection: Selection
var content: Content

init(
selection: Binding<Selection>,
@ViewBuilder content: () -> Content
) {
_selection = selection
self.content = content()
}

var body: some View {
ZStack(alignment: .topTrailing) {
TabView(selection: $selection) {
content
}
.tabViewStyle(.page(indexDisplayMode: .never))
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import XCTest

final class InputInformationFeatureTests: XCTestCase {
override func setUpWithError() throws {}

override func tearDownWithError() throws {}

func testExample() {
XCTAssertEqual(1, 1)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import SwiftUI

public protocol InputLanguageInfoBuildable {
associatedtype ViewType: View
func makeView() -> ViewType
}
12 changes: 12 additions & 0 deletions Projects/Feature/InputLanguageInfoFeature/Project.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import ProjectDescription
import ProjectDescriptionHelpers
import DependencyPlugin

let project = Project.makeModule(
name: ModulePaths.Feature.InputLanguageInfoFeature.rawValue,
product: .staticLibrary,
targets: [.interface, .unitTest],
internalDependencies: [
.Feature.BaseFeature
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import BaseFeature
import InputLanguageInfoFeatureInterface
import NeedleFoundation
import SwiftUI

public protocol InputLanguageInfoDependency: Dependency {}

public final class InputLanguageInfoComponent:
Component<InputLanguageInfoDependency>,
InputLanguageInfoBuildable {

public func makeView() -> some View {
EmptyView()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Foundation

final class InputLanguageInfoIntent: InputLanguageInfoIntentProtocol {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Foundation

protocol InputLanguageInfoIntentProtocol {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

final class InputLanguageInfoModel: ObservableObject, InputLanguageInfoStateProtocol {}

extension InputLanguageInfoModel: InputLanguageInfoActionProtocol {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

protocol InputLanguageInfoStateProtocol {}

protocol InputLanguageInfoActionProtocol: AnyObject {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import BaseFeature
import SwiftUI

struct InputLanguageInfoView: View {
@StateObject var container: MVIContainer<InputLanguageInfoIntentProtocol, InputLanguageInfoStateProtocol>
var intent: any InputLanguageInfoIntentProtocol { container.intent }
var state: any InputLanguageInfoStateProtocol { container.model }

var body: some View {
Text("Hello, World!")
}
}
Loading

0 comments on commit 8670108

Please sign in to comment.