Skip to content

Commit

Permalink
Merge pull request sopt-makers#26 from L-j-h-c/feature/sopt-makers#14-…
Browse files Browse the repository at this point in the history
…missionListUI

[Feat] sopt-makers#14 - 미션 리스트 UI 구현
  • Loading branch information
L-j-h-c authored Dec 4, 2022
2 parents 42e2757 + 2b6cffd commit c25ad0d
Show file tree
Hide file tree
Showing 42 changed files with 922 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// MissionListRepository.swift
// PresentationTests
//
// Created by Junho Lee on 2022/12/03.
// Copyright © 2022 SOPT-Stamp-iOS. All rights reserved.
//

import Combine

import Domain
import Network

public class MissionListRepository {

private let networkService: MissionService
private let cancelBag = Set<AnyCancellable>()

public init(service: MissionService) {
self.networkService = service
}
}

extension MissionListRepository: MissionListRepositoryInterface {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// MissionListModel.swift
// PresentationTests
//
// Created by Junho Lee on 2022/12/03.
// Copyright © 2022 SOPT-Stamp-iOS. All rights reserved.
//

import Foundation

public struct MissionListModel {

public init() {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// MissionListRepositoryInterface.swift
// PresentationTests
//
// Created by Junho Lee on 2022/12/03.
// Copyright © 2022 SOPT-Stamp-iOS. All rights reserved.
//

import Combine

public protocol MissionListRepositoryInterface {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// MissionListUseCase.swift
// PresentationTests
//
// Created by Junho Lee on 2022/12/03.
// Copyright © 2022 SOPT-Stamp-iOS. All rights reserved.
//

import Combine

public protocol MissionListUseCase {

}

public class DefaultMissionListUseCase {

private let repository: MissionListRepositoryInterface
private var cancelBag = Set<AnyCancellable>()

public init(repository: MissionListRepositoryInterface) {
self.repository = repository
}
}

extension DefaultMissionListUseCase: MissionListUseCase {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "LevelOneStamp.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "LevelOneStamp@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "LevelOneStamp@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "LevelThreeStamp.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "LevelThreeStamp@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "LevelThreeStamp@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "LevelTwoStamp.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "LevelTwoStamp@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "LevelTwoStamp@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "MissionBackground.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "MissionBackground@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "MissionBackground@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "icStar.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "icStar@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icStar@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import SnapKit
import Core

@frozen
public enum naviType {
public enum NaviType {
case title /// 좌측 타이틀 + 우측 버튼 (미션 리스트 뷰)
case titleWithLeftButton /// 좌측 뒤로가기 버튼 + 좌측 타이틀 (랭킹, 글 작성 등)
}

@frozen
public enum rightButtonType {
public enum RightButtonType {
case none
case addRecord
case delete
Expand All @@ -31,21 +31,28 @@ public class CustomNavigationBar: UIView {

private var vc: UIViewController?
private let titleLabel = UILabel()
private let titleButton = UIButton()
private let leftButton = UIButton()
private let rightButton = UIButton()

// MARK: - Properties

private var naviType: NaviType!
private var rightButtonClosure: (() -> Void)?
public var rightButtonTapped: Driver<Void> {
rightButton.publisher(for: .touchUpInside)
.map { _ in () }
.asDriver()
}
public var titleButtonTapped: Driver<Void> {
titleButton.publisher(for: .touchUpInside)
.map { _ in () }
.asDriver()
}

// MARK: - Initialize

public init(_ vc: UIViewController, type: naviType) {
public init(_ vc: UIViewController, type: NaviType) {
super.init(frame: .zero)
self.vc = vc
self.setUI(type)
Expand Down Expand Up @@ -75,7 +82,12 @@ extension CustomNavigationBar {

@discardableResult
public func setTitle(_ title: String) -> Self {
self.titleLabel.text = title
switch self.naviType {
case .title:
self.titleButton.setTitle(title, for: .normal)
default:
self.titleLabel.text = title
}
return self
}

Expand All @@ -86,7 +98,7 @@ extension CustomNavigationBar {
}

@discardableResult
public func setRightButton(_ type: rightButtonType) -> Self {
public func setRightButton(_ type: RightButtonType) -> Self {
switch type {
case .none:
self.rightButton.isHidden = true
Expand All @@ -109,6 +121,7 @@ extension CustomNavigationBar {

@discardableResult
public func setTitleTypoStyle(_ font: UIFont) -> Self {
titleButton.titleLabel?.setTypoStyle(font)
titleLabel.setTypoStyle(font)
return self
}
Expand All @@ -131,7 +144,9 @@ extension CustomNavigationBar {
// MARK: - UI & Layout

extension CustomNavigationBar {
private func setUI(_ type: naviType) {
private func setUI(_ type: NaviType) {
self.naviType = type

leftButton.setImage(UIImage(asset: DSKitAsset.Assets.icArrow), for: .normal)

titleLabel.setTypoStyle(.h2)
Expand All @@ -140,15 +155,18 @@ extension CustomNavigationBar {
switch type {
case .title:
rightButton.isHidden = false
rightButton.setImage(UIImage(asset: DSKitAsset.Assets.icAddRecord), for: .normal)
rightButton.setImage(UIImage(asset: DSKitAsset.Assets.icSetting), for: .normal)
titleButton.setImage(DSKitAsset.Assets.icDownArrow.image, for: .normal)
titleButton.setTitleColor(.black, for: .normal)
titleButton.semanticContentAttribute = .forceRightToLeft
case .titleWithLeftButton:
rightButton.isHidden = true
leftButton.setImage(UIImage(asset: DSKitAsset.Assets.icArrow), for: .normal)
rightButton.setImage(UIImage(asset: DSKitAsset.Assets.icAddRecord), for: .normal)
}
}

private func setLayout(_ type: naviType) {
private func setLayout(_ type: NaviType) {
self.snp.makeConstraints { make in
make.height.equalTo(56)
}
Expand All @@ -162,9 +180,9 @@ extension CustomNavigationBar {
}

private func setTitleLayout() {
self.addSubviews(titleLabel, rightButton)
self.addSubviews(titleButton, rightButton)

titleLabel.snp.makeConstraints { make in
titleButton.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.leading.equalToSuperview().inset(20)
}
Expand Down
Loading

0 comments on commit c25ad0d

Please sign in to comment.