Skip to content

Commit

Permalink
[WEAV-139] selectCompany 모듈 생성, 이전
Browse files Browse the repository at this point in the history
  • Loading branch information
jisu15-kim committed Nov 24, 2024
1 parent 7b23570 commit 13d9d28
Show file tree
Hide file tree
Showing 17 changed files with 998 additions and 406 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,24 @@ public struct DropDownPicker<Content: View>: View {
LazyVStack(alignment: .leading, spacing: 0) {
ForEach(0 ..< dataSources.count, id: \.self) { index in
let item = dataSources[index]
Button(action: {
tapHandler?(index)

HStack(spacing: 16) {
Text(item.name)
.typography(.regular_14)
.multilineTextAlignment(.leading)
Spacer()
}
.foregroundStyle(DesignCore.Colors.grey500)
.frame(height: itemSize)
.padding(.horizontal, 16)
.background(.white)
.containerShape(Rectangle())
.onTapGesture {
withAnimation {
showDropDown.toggle()
tapHandler?(index)
}
}, label: {
HStack(spacing: 16) {
Text(item.name)
.typography(.regular_14)
.multilineTextAlignment(.leading)
Spacer()
}
.foregroundStyle(DesignCore.Colors.grey500)
.frame(height: itemSize)
.padding(.horizontal, 16)
.background(.white)
})
}
}
}
.frame(maxWidth: .infinity, alignment: .leading)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//
// EditProfileCompanyIntent.swift
// SignUp
//
// Created by 김지수 on 11/24/24.
// Copyright © 2024 com.weave. All rights reserved.
//

import Foundation
import CommonKit
import CoreKit

//MARK: - Intent
class EditProfileCompanyIntent {
private weak var model: EditProfileCompanyModelActionable?
private let input: DataModel

// MARK: Life cycle
init(
model: EditProfileCompanyModelActionable,
input: DataModel
) {
self.input = input
self.model = model
}
}

//MARK: - Intentable
extension EditProfileCompanyIntent {
protocol Intentable {
// content
func onTapNextButton()

// default
func onAppear()
func task() async
}

struct DataModel {}
}

//MARK: - Intentable
extension EditProfileCompanyIntent: EditProfileCompanyIntent.Intentable {
// default
func onAppear() {}

func task() async {}

// content
func onTapNextButton() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
//
// EditProfileCompanyModel.swift
// SignUp
//
// Created by 김지수 on 11/24/24.
// Copyright © 2024 com.weave. All rights reserved.
//

import Foundation
import CommonKit
import CoreKit

final class EditProfileCompanyModel: ObservableObject {

//MARK: Stateful
protocol Stateful {
// content
var isValidated: Bool { get }

// default
var isLoading: Bool { get }

// error
var showErrorView: ErrorModel? { get }
var showErrorAlert: ErrorModel? { get }
}

//MARK: State Properties
// content
@Published var isValidated: Bool = false

// default
@Published var isLoading: Bool = false

// error
@Published var showErrorView: ErrorModel?
@Published var showErrorAlert: ErrorModel?
}

extension EditProfileCompanyModel: EditProfileCompanyModel.Stateful {}

//MARK: - Actionable
protocol EditProfileCompanyModelActionable: AnyObject {
// content
func setValidation(value: Bool)

// default
func setLoading(status: Bool)

// error
func showErrorView(error: ErrorModel)
func showErrorAlert(error: ErrorModel)
func resetError()
}

extension EditProfileCompanyModel: EditProfileCompanyModelActionable {
// content
func setValidation(value: Bool) {
isValidated = value
}

// default
func setLoading(status: Bool) {
isLoading = status
}

// error
func showErrorView(error: ErrorModel) {
showErrorView = error
}
func showErrorAlert(error: ErrorModel) {
showErrorAlert = error
}
func resetError() {
showErrorView = nil
showErrorAlert = nil
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
//
// EditProfileCompanyView.swift
// SignUp
//
// Created by 김지수 on 11/24/24.
// Copyright © 2024 com.weave. All rights reserved.
//

import SwiftUI
import CoreKit
import DesignCore
import CommonKit

public struct EditProfileCompanyView: View {

@StateObject var container: MVIContainer<EditProfileCompanyIntent.Intentable, EditProfileCompanyModel.Stateful>

private var intent: EditProfileCompanyIntent.Intentable { container.intent }
private var state: EditProfileCompanyModel.Stateful { container.model }

public init() {
let model = EditProfileCompanyModel()
let intent = EditProfileCompanyIntent(
model: model,
input: .init()
)
let container = MVIContainer(
intent: intent as EditProfileCompanyIntent.Intentable,
model: model as EditProfileCompanyModel.Stateful,
modelChangePublisher: model.objectWillChange
)
self._container = StateObject(wrappedValue: container)
}

public var body: some View {
VStack {
Text("Hello MVI")
}
.task {
await intent.task()
}
.onAppear {
intent.onAppear()
}
.ignoresSafeArea(.all)
.textureBackground()
.setPopNavigation {
AppCoordinator.shared.pop()
}
.setLoading(state.isLoading)
}
}

#Preview {
NavigationView {
EditProfileCompanyView()
}
}

//ZStack {
// VStack {
// if let userInfo = state.userInfo {
// HStack {
// Text("💼 내 직군")
// .typography(.regular_12)
// Text(userInfo.profile.jobOccupation)
// .pretendard(
// weight: ._600,
// size: 12
// )
// }
// .foregroundStyle(DesignCore.Colors.grey400)
// .padding(.horizontal, 20)
// .padding(.vertical, 10)
// .background(
// Capsule()
// .fill(DesignCore.Colors.yellow50)
// .stroke(
// Color(hex: 0xEDE9C1),
// lineWidth: 1
// )
// )
// .padding(.vertical, 10)
// }
// JobSelectionView(
// selected: [state.singleSelectedJob].compactMap { $0 }
// ) { job in
// intent.onTapJobOccupation(
// selectedJob: job
// )
// }
// .padding(.bottom, 90)
// }
//
// CTABottomButton(
// title: "다음",
// isActive: state.isValidated
// ) {
// intent.onTapNextButton(state: state)
// }
//}
//.task {
// await intent.task()
//}
//.onAppear {
// intent.onAppear()
//}
//.ignoresSafeArea(.keyboard)
//.navigationTitle("직군 수정")
//.textureBackground()
//.setPopNavigation {
// AppCoordinator.shared.pop()
//}
//.setLoading(state.isLoading)
19 changes: 17 additions & 2 deletions Projects/Features/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,26 @@ let project: Project = .make(
]
),
.make(
target: .signUp,
target: .searchCompany,
dependencies: [
.project(target: .commonKit),
.project(target: .designCore)
]
),
.makeUnitTest(
target: .searchCompany,
dependencies: [
.project(target: .searchCompany)
]
),
.make(
target: .signUp,
dependencies: [
.project(target: .commonKit),
.project(target: .designCore),
.project(target: .searchCompany)
]
),
.makeUnitTest(
target: .signUp,
dependencies: [
Expand All @@ -28,7 +42,8 @@ let project: Project = .make(
target: .home,
dependencies: [
.project(target: .commonKit),
.project(target: .designCore)
.project(target: .designCore),
.project(target: .searchCompany)
]
),
.makeUnitTest(
Expand Down
Loading

0 comments on commit 13d9d28

Please sign in to comment.