Skip to content

Commit

Permalink
[#57] 메인 탭바 디자인 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
MojitoBar committed Jun 9, 2023
1 parent 95d89c8 commit 58cd195
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 13 deletions.
4 changes: 4 additions & 0 deletions MyPack.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
43DCDBD429DEAFD800FFE1F9 /* MyPackAnimation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43DCDBCE29DEAFD700FFE1F9 /* MyPackAnimation.framework */; };
43DCDBD529DEAFD800FFE1F9 /* MyPackAnimation.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 43DCDBCE29DEAFD700FFE1F9 /* MyPackAnimation.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
43DCDBDB29DEB06B00FFE1F9 /* CardAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43DCDBDA29DEB06B00FFE1F9 /* CardAnimator.swift */; };
43E9E49C2A336A58004B3FD6 /* WaveGradientView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43E9E49B2A336A58004B3FD6 /* WaveGradientView.swift */; };
43F144C329EE77BA00C2FA37 /* GoogleSignIn in Frameworks */ = {isa = PBXBuildFile; productRef = 43F144C229EE77BA00C2FA37 /* GoogleSignIn */; };
43F144C929EE83E200C2FA37 /* GoogleSignIn in Frameworks */ = {isa = PBXBuildFile; productRef = 43F144C829EE83E200C2FA37 /* GoogleSignIn */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -200,6 +201,7 @@
43DCDBC729DE8A8400FFE1F9 /* UIColor+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+Extension.swift"; sourceTree = "<group>"; };
43DCDBCE29DEAFD700FFE1F9 /* MyPackAnimation.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MyPackAnimation.framework; sourceTree = BUILT_PRODUCTS_DIR; };
43DCDBDA29DEB06B00FFE1F9 /* CardAnimator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardAnimator.swift; sourceTree = "<group>"; };
43E9E49B2A336A58004B3FD6 /* WaveGradientView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WaveGradientView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -365,6 +367,7 @@
2AEF7B0C29E51F9C00CA5A93 /* BoxView.swift */,
439E953329D52E0400F104EF /* LoginButton.swift */,
2AEF7B1729E529F800CA5A93 /* LogoLabel.swift */,
43E9E49B2A336A58004B3FD6 /* WaveGradientView.swift */,
);
path = UI;
sourceTree = "<group>";
Expand Down Expand Up @@ -1067,6 +1070,7 @@
4399C61E29D8918900794E69 /* MainTabCoordinator.swift in Sources */,
434CB0E02A1CB5DA0091EE76 /* BackBtn.swift in Sources */,
2A3CDDEC29D3AB7700BCF348 /* MainTabBarViewController.swift in Sources */,
43E9E49C2A336A58004B3FD6 /* WaveGradientView.swift in Sources */,
4399C60129D889CD00794E69 /* LoginService.swift in Sources */,
434CB0DC2A1CAC510091EE76 /* UITextField+Extension.swift in Sources */,
2A3CDDFC29D3B04F00BCF348 /* ThirdViewController.swift in Sources */,
Expand Down
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 MyPack/Assets/Assets.xcassets/CAT.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "CAT.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
80 changes: 80 additions & 0 deletions MyPack/Login/View/UI/WaveGradientView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
//
// WaveGradientView.swift
// MyPack
//
// Created by jito on 2023/06/09.
//

import Foundation
import UIKit

class WaveGradientView: UIView {
var gradientLayer: CAGradientLayer!
var waveLayer: CAShapeLayer!

override func layoutSubviews() {
super.layoutSubviews()
createGradientLayer()
createWaveLayer()
animateGradient()
animateWave()
}

func createGradientLayer() {
gradientLayer = CAGradientLayer()
gradientLayer.frame = bounds

gradientLayer.colors = [UIColor.red.cgColor, UIColor.blue.cgColor]
gradientLayer.startPoint = CGPoint(x: 0, y: 0.5)
gradientLayer.endPoint = CGPoint(x: 1, y: 0.5)

layer.addSublayer(gradientLayer)
}

func animateGradient() {
let gradientChangeAnimation = CABasicAnimation(keyPath: "colors")
gradientChangeAnimation.duration = 2.0
gradientChangeAnimation.toValue = [UIColor.yellow.cgColor, UIColor.green.cgColor]
gradientChangeAnimation.autoreverses = true
gradientChangeAnimation.repeatCount = Float.infinity

gradientLayer.add(gradientChangeAnimation, forKey: nil)
}

func createWaveLayer() {
waveLayer = CAShapeLayer()
waveLayer.path = createWavePath(amplitude: 20, frequency: 20).cgPath
waveLayer.fillColor = UIColor.clear.cgColor
waveLayer.strokeColor = UIColor.black.cgColor
waveLayer.lineWidth = 2

layer.addSublayer(waveLayer)
}

func createWavePath(amplitude: CGFloat, frequency: CGFloat) -> UIBezierPath {
let path = UIBezierPath()
let midY = bounds.midY

for x in stride(from: CGFloat(0), to: bounds.width, by: 1) {
let relativeX = x / bounds.width
let sine = sin(relativeX * frequency + 0) * amplitude + midY
if x == 0 {
path.move(to: CGPoint(x: 0, y: sine))
} else {
path.addLine(to: CGPoint(x: x, y: sine))
}
}

return path
}

func animateWave() {
let waveAnimation = CABasicAnimation(keyPath: "path")
waveAnimation.toValue = createWavePath(amplitude: 20, frequency: 20).cgPath
waveAnimation.duration = 2.0
waveAnimation.autoreverses = true
waveAnimation.repeatCount = Float.infinity

waveLayer.add(waveAnimation, forKey: nil)
}
}
7 changes: 0 additions & 7 deletions MyPack/Login/View/ViewController/LoginViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ class LoginViewController: UIViewController {
return view
}()

private lazy var logoShadowView: UIImageView = {
let view = UIImageView(frame: CGRect(x: 108, y: 340, width: 180, height: 90))
view.image = UIImage(named: "imgmypack.png")!
return view
}()

private lazy var logoLabel: LogoLabel = {
let label = LogoLabel(text: "My Pack", font: UIFont(name: "PingFangSC-Semibold", size: 64)!, textColor: UIColor(rgb: 0x3A3A3A), shadow: true)
return label
Expand Down Expand Up @@ -81,7 +75,6 @@ extension LoginViewController {
func addUI() {
view.addSubview(boxView)
view.addSubview(logoView)
view.addSubview(logoShadowView)
view.addSubview(logoLabel)
view.addSubview(googleloginButton)
view.addSubview(appleloginButton)
Expand Down
10 changes: 7 additions & 3 deletions MyPack/Main/Coordinator/Implement/MainTabCoordinatorImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,26 @@ class MainTabBarCoordinatorImpl: MainTabBarCoordinator {
}

func start(userName: String) {
let largeConfig = UIImage.SymbolConfiguration(pointSize: 20, weight: .bold, scale: .large)

let viewModel = MainTabBarViewModel()
viewModel.mainTabCoordinator = self
let mainTabBarViewController = MainTabBarViewController(viewModel: viewModel)

mainTabBarViewController.tabBar.tintColor = .white

let cardService = CardServiceImpl()
let firstViewModel = FirstViewModel(userName: userName, mainTabBarCoordinator: self, cardService: cardService)
let firstViewController = FirstViewController(viewModel: firstViewModel)
firstViewController.tabBarItem = UITabBarItem(title: viewModel.title(at: 0), image: UIImage(systemName: "1.circle"), tag: 0)
firstViewController.tabBarItem = UITabBarItem(title: "Pack!", image: UIImage(systemName: "sparkles.square.filled.on.square", withConfiguration: largeConfig), tag: 0)

let secondViewModel = SecondViewModel(mainTabBarCoordinator: self)
let secondViewController = SecondViewController(viewModel: secondViewModel)
secondViewController.tabBarItem = UITabBarItem(title: viewModel.title(at: 1), image: UIImage(systemName: "plus.circle"), tag: 1)
secondViewController.tabBarItem = UITabBarItem(title: "Upload", image: UIImage(systemName: "plus.circle", withConfiguration: largeConfig), tag: 1)

let thirdViewModel = ThirdViewModel()
let thirdViewController = ThirdViewController(viewModel: thirdViewModel)
thirdViewController.tabBarItem = UITabBarItem(title: viewModel.title(at: 2), image: UIImage(systemName: "3.circle"), tag: 2)
thirdViewController.tabBarItem = UITabBarItem(title: "My Page", image: UIImage(systemName: "person.crop.circle", withConfiguration: largeConfig), tag: 2)

mainTabBarViewController.viewControllers = [firstViewController, secondViewController, thirdViewController]
navigationController?.pushViewController(mainTabBarViewController, animated: true)
Expand Down
1 change: 1 addition & 0 deletions MyPack/Main/View/UI/Card.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ extension Card {
backView.addSubview(content)
content.font = UIFont.systemFont(ofSize: 16, weight: .medium)
content.textColor = .black
content.numberOfLines = 0
content.snp.makeConstraints { make in
make.top.equalTo(title.snp.bottom).offset(10)
make.leading.equalTo(16)
Expand Down
15 changes: 14 additions & 1 deletion MyPack/Main/View/ViewController/FirstViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,21 @@ class FirstViewController: UIViewController {
private var disposableBag = Set<AnyCancellable>()
private var cardDeck: CardDeck = .init(cardDeck: [])
private var searchBtn: SearchBtn
private var myPackTitle: UILabel = {
let label = UILabel()
label.text = "MyPack"
label.textColor = .white
label.font = UIFont.systemFont(ofSize: 26, weight: .bold)
return label
}()

private var emitterAnimators = [EmitterAnimator]()

init(viewModel: FirstViewModel) {
self.viewModel = viewModel
self.searchBtn = SearchBtn(viewModel: self.viewModel)
super.init(nibName: nil, bundle: nil)
view.backgroundColor = UIColor(rgb: 0x222222)
view.backgroundColor = UIColor(rgb: 0x111111)
}

@available(*, unavailable)
Expand Down Expand Up @@ -72,6 +80,7 @@ private extension FirstViewController {
func addUI() {
view.addSubview(cardDeck)
view.addSubview(searchBtn)
view.addSubview(myPackTitle)
}

func setLayout() {
Expand All @@ -87,6 +96,10 @@ private extension FirstViewController {
btn.top.equalTo(view.safeAreaLayoutGuide)
btn.trailing.equalTo(-16)
}
myPackTitle.snp.makeConstraints { label in
label.top.equalTo(view.safeAreaInsets)
label.leading.equalTo(20)
}
}

func updateUser(userName _: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ extension MainTabBarViewController {
override func viewDidLoad() {
super.viewDidLoad()
delegate = self
view.backgroundColor = .white
setBindings()
}
}
Expand Down
2 changes: 1 addition & 1 deletion MyPack/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
let navigationController = UINavigationController()
navigationController.isNavigationBarHidden = true
loginCoordinator = LoginCoordinatorImpl(navigationController: navigationController)
loginCoordinator?.start()
loginCoordinator?.didLoginSuccessfully(userName: "jito")

window?.rootViewController = navigationController
window?.makeKeyAndVisible()
Expand Down

0 comments on commit 58cd195

Please sign in to comment.