Skip to content

Commit

Permalink
Merge pull request #181 from Team-Recordy/feature/#161
Browse files Browse the repository at this point in the history
어디까지 했는지 기억이 안나서 합치겠습니다.
  • Loading branch information
sozohoy authored Jan 8, 2025
2 parents 845fd68 + 2867569 commit 15657a5
Show file tree
Hide file tree
Showing 26 changed files with 1,434 additions and 637 deletions.
21 changes: 21 additions & 0 deletions Common/Resources/Asset.xcassets/link.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "link.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.
21 changes: 21 additions & 0 deletions Common/Resources/Asset.xcassets/report.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "report.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.
21 changes: 21 additions & 0 deletions Common/Resources/Asset.xcassets/seeMore.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "seeMore.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"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.
12 changes: 9 additions & 3 deletions Common/Sources/Base/BaseNavigationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,23 @@ public class BaseNavigationController: UINavigationController {
appearance.backgroundColor = .clear
appearance.shadowColor = .clear
appearance.titleTextAttributes = [
NSAttributedString.Key.foregroundColor: CommonAsset.recordyWhite.color,
NSAttributedString.Key.font: RecordyFont.title3.font
NSAttributedString.Key.foregroundColor: CommonAsset.viskitGray01.color,
NSAttributedString.Key.font: ViskitFont.title3.font
]
appearance.buttonAppearance.normal.titleTextAttributes = [
NSAttributedString.Key.foregroundColor: CommonAsset.recordyWhite.color
NSAttributedString.Key.foregroundColor: CommonAsset.viskitGray01.color
]

navigationBar.standardAppearance = appearance
navigationBar.scrollEdgeAppearance = navigationBar.standardAppearance

navigationBar.tintColor = .white
navigationItem.backButtonDisplayMode = .minimal
navigationBar.topItem?.backBarButtonItem = UIBarButtonItem(
title: "",
style: .plain,
target: nil,
action: nil
)
}
}
131 changes: 0 additions & 131 deletions Common/Sources/Components/RecordyToggle.swift

This file was deleted.

139 changes: 139 additions & 0 deletions Common/Sources/Components/ViskitToggle.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
//
// RecordyToggle.swift
// Common
//
// Created by 한지석 on 7/10/24.
// Copyright © 2024 com.recordy. All rights reserved.
//

import UIKit

import SnapKit
import Then

public enum ToggleState {
case all
case following
}

public class ViskitToggle: UIButton {

var toggleState: ToggleState = .following {
didSet {
self.update()
}
}

public var toggleAction: ((ToggleState) -> Void)?

private let backgroundView = UIStackView()
private let leftStateView = UIView()
private let rightStateView = UIView()
private let leftStateLabel = UILabel()
private let rightStateLabel = UILabel()

public override init(frame: CGRect) {
super.init(frame: frame)
setStyle()
setUI()
setAutolayout()
setState(state: .following)
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

public override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesEnded(touches, with: event)
toggle()
toggleAction?(toggleState)
}

private func setStyle() {
backgroundView.do {
$0.axis = .horizontal
$0.layer.backgroundColor = (UIColor.black.cgColor).copy(alpha: 0.2)
$0.isLayoutMarginsRelativeArrangement = true
$0.cornerRadius(15)
$0.isUserInteractionEnabled = false
}

leftStateView.do {
$0.cornerRadius(15)
$0.backgroundColor = CommonAsset.viskitGray10.color
$0.isUserInteractionEnabled = false
}

rightStateView.do {
$0.cornerRadius(15)
$0.isUserInteractionEnabled = false
}

leftStateLabel.do {
$0.text = "전체"
$0.textColor = .white
$0.font = ViskitFont.body2.font
}

rightStateLabel.do {
$0.text = "팔로잉"
$0.textColor = .white
$0.font = ViskitFont.body2.font
}
}

private func setUI() {
backgroundView.addArrangedSubview(leftStateView)
backgroundView.addArrangedSubview(rightStateView)
leftStateView.addSubview(leftStateLabel)
rightStateView.addSubview(rightStateLabel)
addSubview(backgroundView)
}

private func setAutolayout() {
backgroundView.snp.makeConstraints {
$0.top.equalTo(snp.top)
$0.bottom.equalTo(snp.bottom)
$0.leading.equalTo(snp.leading)
$0.trailing.equalTo(snp.trailing)
}
leftStateView.snp.makeConstraints {
$0.width.equalTo(snp.width).multipliedBy(0.5)
$0.height.equalTo(snp.height)
}
rightStateView.snp.makeConstraints {
$0.width.equalTo(snp.width).multipliedBy(0.5)
$0.height.equalTo(snp.height)
}
leftStateLabel.snp.makeConstraints {
$0.centerX.equalToSuperview()
$0.centerY.equalToSuperview()
}
rightStateLabel.snp.makeConstraints {
$0.centerX.equalToSuperview()
$0.centerY.equalToSuperview()
}
}

func update() {
UIView.animate(withDuration: 0.3) { [weak self] in
guard let self else { return }
if self.toggleState == .all {
self.leftStateView.backgroundColor = CommonAsset.recordyGrey08.color
self.rightStateView.backgroundColor = .clear
} else {
self.leftStateView.backgroundColor = .clear
self.rightStateView.backgroundColor = CommonAsset.recordyGrey08.color
}
}
}

public func toggle() {
toggleState == .all ? setState(state: .following) : setState(state: .all)
}

func setState(state: ToggleState) {
toggleState = state
}
}
1 change: 0 additions & 1 deletion Core/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ let project = Project.makeModule(
.external(name: "Moya", condition: .none),
.external(name: "RxSwift", condition: .none),
.external(name: "RxMoya", condition: .none),
.external(name: "RxSwift", condition: .none),
.external(name: "RxCocoa", condition: .none),
.external(name: "AWSS3", condition: .none)
]
Expand Down
Loading

0 comments on commit 15657a5

Please sign in to comment.