diff --git a/Projects/Features/SelfCareFeature/Demo/Sources/Application/SceneDelegate.swift b/Projects/Features/SelfCareFeature/Demo/Sources/Application/SceneDelegate.swift index 809178f3..9d3a089c 100644 --- a/Projects/Features/SelfCareFeature/Demo/Sources/Application/SceneDelegate.swift +++ b/Projects/Features/SelfCareFeature/Demo/Sources/Application/SceneDelegate.swift @@ -17,10 +17,10 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { guard let windowScene = (scene as? UIWindowScene) else { return } window = UIWindow(windowScene: windowScene) - let useCase = DefaultSelfCareUseCase(repository: SelfCareRepository(networkService: SelfCareService())) - let viewModel = SelfCareTargetMainViewModel(useCase: useCase) - let viewController = SelfCareTargetMainViewController(viewModel) - window?.configure(withRootViewController: viewController) +// let useCase = DefaultSelfCareUseCase(repository: SelfCareRepository(networkService: SelfCareService())) +// let viewModel = SelfCareTargetMainViewModel(useCase: useCase) +// let viewController = SelfCareTargetMainViewController(viewModel) + let viewController = SelfCareProfileViewController(ProfileEditViewModel()) window?.configure(withRootViewController: viewController) window?.makeKeyAndVisible() } diff --git a/Projects/Features/SelfCareFeature/Sources/HomeScene/SelfCareHomeViewController.swift b/Projects/Features/SelfCareFeature/Sources/HomeScene/SelfCareHomeViewController.swift index af8fc303..c7216dc1 100644 --- a/Projects/Features/SelfCareFeature/Sources/HomeScene/SelfCareHomeViewController.swift +++ b/Projects/Features/SelfCareFeature/Sources/HomeScene/SelfCareHomeViewController.swift @@ -31,15 +31,15 @@ public class SelfCareHomeViewController: BaseViewController { + private lazy var navBar = SelfCareProfileNavigationBar() + + private lazy var userProfileImageView = MGProfileView( + profileImage: MGProfileImage(type: .custom, + customImage: SelfCareResourcesService.Assets.baseProfile), + profileType: .maxProfile) + + private lazy var userNameLabel = MGLabel(text: "박준하", + font: UIFont.Pretendard.titleMedium, + textColor: .black) + private var bageView = SelfCareBageView() + + public override func viewDidLoad() { + super.viewDidLoad() + + view.backgroundColor = .white + } + + public override func configureNavigationBar() { + super.configureNavigationBar() + + navigationController?.isNavigationBarHidden = true + } + + public override func layout() { + super.layout() + + view.addSubviews([navBar, + userProfileImageView, + userNameLabel, + bageView + ]) + + navBar.snp.makeConstraints { + $0.leading.top.trailing.equalTo(view.safeAreaLayoutGuide) + } + + userProfileImageView.snp.makeConstraints { + $0.top.equalTo(navBar.snp.bottom).offset(24.0) + $0.leading.equalToSuperview().offset(20.0) + } + + userNameLabel.snp.makeConstraints { + $0.top.equalTo(userProfileImageView.snp.bottom).offset(16.0) + $0.leading.equalTo(userProfileImageView.snp.leading) + } + + bageView.snp.makeConstraints { + $0.top.equalTo(userNameLabel.snp.bottom).offset(32.0) + $0.width.equalTo(390) + $0.centerX.equalToSuperview() + } + } +} diff --git a/Projects/Features/SelfCareFeature/Sources/ProfileScene/View/BageView/SelfCareBageView.swift b/Projects/Features/SelfCareFeature/Sources/ProfileScene/View/BageView/SelfCareBageView.swift new file mode 100644 index 00000000..ccc2f449 --- /dev/null +++ b/Projects/Features/SelfCareFeature/Sources/ProfileScene/View/BageView/SelfCareBageView.swift @@ -0,0 +1,116 @@ +import UIKit + +import SnapKit +import Then + +import DSKit + +public class SelfCareBageView: UIView { + private let shadows = UIView() + private let shapes = UIView() + private let gradientLayer = CAGradientLayer() + private let heartImageView = UIImageView().then { + $0.contentMode = .scaleAspectFit + $0.image = UIImage(systemName: "heart.fill") + $0.tintColor = .red + } + + public var bageNameLabel = MGLabel(text: "마음 뱃지", + font: UIFont.Pretendard.titleMedium, + textColor: .black) + public var userTimeLabel = MGLabel(text: "총 124시간 운동하셨어요!", + font: UIFont.Pretendard.bodyMedium, + textColor: .black) + + override init(frame: CGRect) { + super.init(frame: frame) + setupView() + } + + required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + setupView() + } + + private func setupView() { + self.frame = CGRect(x: 0, y: 0, width: 390, height: 247) + + setupShadows() + setupShapes() + addHeartIcon() + } + + private func setupShadows() { + shadows.frame = bounds + shadows.clipsToBounds = false + addSubview(shadows) + + let shadowPath0 = UIBezierPath(roundedRect: shadows.bounds, cornerRadius: 16) + let layer0 = CALayer() + layer0.shadowPath = shadowPath0.cgPath + layer0.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.25).cgColor + layer0.shadowOpacity = 1 + layer0.shadowRadius = 4 + layer0.shadowOffset = CGSize(width: 0, height: 4) + layer0.bounds = shadows.bounds + layer0.position = shadows.center + shadows.layer.addSublayer(layer0) + } + + private func setupShapes() { + shapes.frame = bounds + shapes.clipsToBounds = true + addSubview(shapes) + + gradientLayer.colors = [ + UIColor.lighterGray.cgColor, + UIColor.darkerGray.cgColor + ] + gradientLayer.locations = [0, 1] + gradientLayer.startPoint = CGPoint(x: 0.25, y: 0.5) + gradientLayer.endPoint = CGPoint(x: 0.75, y: 0.5) + gradientLayer.transform = CATransform3DMakeAffineTransform(CGAffineTransform( + a: 0, b: 1, c: -1, d: 0, tx: 1, ty: 0) + ) + gradientLayer.bounds = shapes.bounds.insetBy( + dx: -0.5 * shapes.bounds.size.width, dy: -0.5 * shapes.bounds.size.height + ) + gradientLayer.position = shapes.center + shapes.layer.addSublayer(gradientLayer) + shapes.layer.cornerRadius = 16 + shapes.layer.borderWidth = 2 + shapes.layer.borderColor = UIColor.lighterGray.cgColor + } + + private func addHeartIcon() { + addSubviews([heartImageView, + bageNameLabel, + userTimeLabel]) + + heartImageView.snp.makeConstraints { + $0.top.equalToSuperview().offset(45.0) + $0.centerX.equalToSuperview() + $0.size.equalTo(80) + } + + bageNameLabel.snp.makeConstraints { + $0.top.equalTo(heartImageView.snp.bottom).offset(32.0) + $0.centerX.equalToSuperview() + } + + userTimeLabel.snp.makeConstraints { + $0.top.equalTo(bageNameLabel.snp.bottom).offset(6.0) + $0.centerX.equalToSuperview() + } + } +} + +extension UIColor { + static var lighterGray: UIColor { + return UIColor(red: 0.942, green: 0.948, blue: 0.961, alpha: 1) + } + + static var darkerGray: UIColor { + return UIColor.white + } +} diff --git a/Projects/Features/SelfCareFeature/Sources/ProfileScene/View/NavigationBar/SelfCareProfileNavigationBar.swift b/Projects/Features/SelfCareFeature/Sources/ProfileScene/View/NavigationBar/SelfCareProfileNavigationBar.swift new file mode 100644 index 00000000..8a16677c --- /dev/null +++ b/Projects/Features/SelfCareFeature/Sources/ProfileScene/View/NavigationBar/SelfCareProfileNavigationBar.swift @@ -0,0 +1,58 @@ +import UIKit + +import RxSwift +import RxCocoa + +import Core +import DSKit + +import MGNetworks + +final public class SelfCareProfileNavigationBar: UIView { + + public var leftButtonTap: ControlEvent { + return leftButton.rx.tap + } + + private let leftButton = MGImageButton(image: SelfCareResourcesService.Assets.leftArrow.withTintColor(.black)) + + private let leftLabel = MGLabel(text: SelfCareResourcesService.Title.myProfileEdit, + font: UIFont.Pretendard.labelLarge, + textColor: .black + ) + + private lazy var leftItemsStackView = UIStackView(arrangedSubviews: [leftButton, leftLabel]).then { + $0.axis = .horizontal + $0.spacing = 0 + $0.distribution = .fillEqually + } + + public init() { + super.init(frame: .zero) + setUI() + setLayout() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +private extension SelfCareProfileNavigationBar { + func setUI() { + self.backgroundColor = .white + } + + func setLayout() { + self.addSubview(leftItemsStackView) + + self.snp.makeConstraints { + $0.height.equalTo(48.0) + } + + leftItemsStackView.snp.makeConstraints { + $0.top.bottom.equalToSuperview() + $0.leading.equalToSuperview().offset(-10.0) + } + } +} diff --git a/Projects/Features/SelfCareFeature/Sources/ProfileScene/ViewModel/ProfileEditViewModel.swift b/Projects/Features/SelfCareFeature/Sources/ProfileScene/ViewModel/ProfileEditViewModel.swift new file mode 100644 index 00000000..f911b533 --- /dev/null +++ b/Projects/Features/SelfCareFeature/Sources/ProfileScene/ViewModel/ProfileEditViewModel.swift @@ -0,0 +1,25 @@ +import UIKit + +import RxFlow +import RxCocoa +import RxSwift + +import Core + +public class ProfileEditViewModel: BaseViewModel { + public func transform(_ input: Input, action: (Output) -> Void) -> Output { + return Output() + } + + public struct Input { + + } + + public struct Output { + + } + + public init() { + + } +} diff --git a/Projects/Features/SelfCareFeature/Sources/SelfCareScene/View/SelfCareMyRoutineDetailViewController.swift b/Projects/Features/SelfCareFeature/Sources/SelfCareScene/View/SelfCareMyRoutineDetailViewController.swift index 0922b13a..6a8274eb 100644 --- a/Projects/Features/SelfCareFeature/Sources/SelfCareScene/View/SelfCareMyRoutineDetailViewController.swift +++ b/Projects/Features/SelfCareFeature/Sources/SelfCareScene/View/SelfCareMyRoutineDetailViewController.swift @@ -44,7 +44,7 @@ public class SelfCareMyRoutineDetailViewController: BaseViewController