-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7b23570
commit 13d9d28
Showing
17 changed files
with
998 additions
and
406 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
51 changes: 51 additions & 0 deletions
51
...atures/Home/Sources/Profile/EditProfile/EditProfileCompany/EditProfileCompanyIntent.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,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() {} | ||
} |
78 changes: 78 additions & 0 deletions
78
...eatures/Home/Sources/Profile/EditProfile/EditProfileCompany/EditProfileCompanyModel.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,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 | ||
} | ||
} |
114 changes: 114 additions & 0 deletions
114
...Features/Home/Sources/Profile/EditProfile/EditProfileCompany/EditProfileCompanyView.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,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) |
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
Oops, something went wrong.