Skip to content

Commit

Permalink
[Chore] Health-Food-Me#150 - 로딩뷰 구현에 필요한 뷰 파일 생성 및 json 파일명 변경 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
yungu0010 committed Jul 20, 2022
1 parent 8b8f02b commit 064a6da
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 21 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//
// HelfmeLoadingVC.swift
// HealthFoodMe
//
// Created by 강윤서 on 2022/07/20.
//

import UIKit

import Lottie
import SnapKit

class HelfmeLoadingVC: UIView {
private var contentView: UIView = {
let view = UIView()
view.backgroundColor = .black.withAlphaComponent(0.4)
view.alpha = 0
return view
}()

private var loadingView: AnimationView = {
let animationView = AnimationView(name: "loading_iOS")
animationView.loopMode = .loop

return animationView
}()
}

extension HelfmeLoadingVC {
private func setLayout() {
self.addSubview(contentView)
contentView.addSubview(loadingView)

contentView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}

loadingView.snp.makeConstraints { make in
make.center.equalTo(safeAreaLayoutGuide)
make.size.equalTo(300)
}
}

func show() {
guard !AppDelegate.window.subviews.contains(where: {$0 is HelfmeLoadingVC})
self.layoutIfNeeded()
self.loadingView.play()
}

func hide(completion: @escaping () -> ()) {
self.loadingView.stop()
self.removeFromSuperview()
completion()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SplashVC: UIViewController {

// MARK: - UI Components

private let animationView: AnimationView = .init(name: "splash_ios")
private let animationView: AnimationView = .init(name: "splash_iOS")

// MARK: - View Life Cycle

Expand Down

0 comments on commit 064a6da

Please sign in to comment.