Skip to content

Commit

Permalink
Merge pull request #151 from yungu0010/feature/#150
Browse files Browse the repository at this point in the history
[Feat] #150 - 로딩 뷰 구현
  • Loading branch information
yungu0010 authored Jul 20, 2022
2 parents 032a2b3 + 6a5058a commit 0ba4bda
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 15 deletions.
38 changes: 31 additions & 7 deletions HealthFoodMe/HealthFoodMe.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
3B723C932880074200822B7C /* ReviewDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B723C922880074200822B7C /* ReviewDataModel.swift */; };
3B723CA32881AB8A00822B7C /* ReviewDetailVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B723CA22881AB8A00822B7C /* ReviewDetailVC.swift */; };
3B723CA52881B36F00822B7C /* ReviewDetail.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3B723CA42881B36F00822B7C /* ReviewDetail.storyboard */; };
3B93ED4E2887C9CB00240434 /* HelfmeLoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B93ED4D2887C9CB00240434 /* HelfmeLoadingView.swift */; };
3B93ED522887CBC500240434 /* loading_iOS.json in Resources */ = {isa = PBXBuildFile; fileRef = 3B93ED512887CBC500240434 /* loading_iOS.json */; };
3B9EF0F028854053009DEEDE /* SocialLoginEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B9EF0EF28854053009DEEDE /* SocialLoginEntity.swift */; };
3B9EF0FB2885D340009DEEDE /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B9EF0FA2885D340009DEEDE /* GoogleService-Info.plist */; };
3B9EF0FE2885D372009DEEDE /* ReviewListEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B9EF0FD2885D372009DEEDE /* ReviewListEntity.swift */; };
Expand Down Expand Up @@ -222,7 +224,7 @@
FD72FCC028834AB60092746F /* MainMapNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD72FCBF28834AB60092746F /* MainMapNavigationController.swift */; };
FDA3AEF82880612300D6CCB4 /* UserWithdrawalUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDA3AEF22880612300D6CCB4 /* UserWithdrawalUseCase.swift */; };
FDA54A3B287DEAB2009D5BCE /* CustomSegementControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDA54A3A287DEAB2009D5BCE /* CustomSegementControl.swift */; };
FDC46A25288326AC00F62D20 /* splash_ios.json in Resources */ = {isa = PBXBuildFile; fileRef = FDC46A24288326AB00F62D20 /* splash_ios.json */; };
FDC46A25288326AC00F62D20 /* splash_iOS.json in Resources */ = {isa = PBXBuildFile; fileRef = FDC46A24288326AB00F62D20 /* splash_iOS.json */; };
FDCD5B452881ACC100EAEF51 /* LocationLiterals.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDCD5B442881ACC100EAEF51 /* LocationLiterals.swift */; };
FDCD5B472882083200EAEF51 /* mapContainerViewCameraDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDCD5B462882083200EAEF51 /* mapContainerViewCameraDelegateProxy.swift */; };
FDF2E1FA287EFA5B0007D4F9 /* SampleStarVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDF2E1F9287EFA5B0007D4F9 /* SampleStarVC.swift */; };
Expand All @@ -249,6 +251,8 @@
3B723C922880074200822B7C /* ReviewDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewDataModel.swift; sourceTree = "<group>"; };
3B723CA22881AB8A00822B7C /* ReviewDetailVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewDetailVC.swift; sourceTree = "<group>"; };
3B723CA42881B36F00822B7C /* ReviewDetail.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = ReviewDetail.storyboard; sourceTree = "<group>"; };
3B93ED4D2887C9CB00240434 /* HelfmeLoadingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HelfmeLoadingView.swift; sourceTree = "<group>"; };
3B93ED512887CBC500240434 /* loading_iOS.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = loading_iOS.json; sourceTree = "<group>"; };
3B9EF0EF28854053009DEEDE /* SocialLoginEntity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SocialLoginEntity.swift; sourceTree = "<group>"; };
3B9EF0FA2885D340009DEEDE /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
3B9EF0FD2885D372009DEEDE /* ReviewListEntity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewListEntity.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -453,7 +457,7 @@
FD72FCBF28834AB60092746F /* MainMapNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainMapNavigationController.swift; sourceTree = "<group>"; };
FDA3AEF22880612300D6CCB4 /* UserWithdrawalUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserWithdrawalUseCase.swift; sourceTree = "<group>"; };
FDA54A3A287DEAB2009D5BCE /* CustomSegementControl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomSegementControl.swift; sourceTree = "<group>"; };
FDC46A24288326AB00F62D20 /* splash_ios.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = splash_ios.json; sourceTree = "<group>"; };
FDC46A24288326AB00F62D20 /* splash_iOS.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = splash_iOS.json; sourceTree = "<group>"; };
FDCD5B442881ACC100EAEF51 /* LocationLiterals.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationLiterals.swift; sourceTree = "<group>"; };
FDCD5B462882083200EAEF51 /* mapContainerViewCameraDelegateProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = mapContainerViewCameraDelegateProxy.swift; sourceTree = "<group>"; };
FDF2E1F9287EFA5B0007D4F9 /* SampleStarVC.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = SampleStarVC.swift; sourceTree = "<group>"; tabWidth = 4; };
Expand Down Expand Up @@ -545,6 +549,22 @@
path = VC;
sourceTree = "<group>";
};
3B93ED4B2887C5D900240434 /* HelfmeLoading */ = {
isa = PBXGroup;
children = (
3B93ED532887E23600240434 /* View */,
);
path = HelfmeLoading;
sourceTree = "<group>";
};
3B93ED532887E23600240434 /* View */ = {
isa = PBXGroup;
children = (
3B93ED4D2887C9CB00240434 /* HelfmeLoadingView.swift */,
);
path = View;
sourceTree = "<group>";
};
3B9EF0EE28854039009DEEDE /* SocialLoginScene */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -890,13 +910,13 @@
path = View;
sourceTree = "<group>";
};
A93252BE288086BA001EDF50 /* HelpmeAlerts */ = {
A93252BE288086BA001EDF50 /* HelfmeAlerts */ = {
isa = PBXGroup;
children = (
A93252D72880B13A001EDF50 /* VC */,
A93252D028809144001EDF50 /* Views */,
);
path = HelpmeAlerts;
path = HelfmeAlerts;
sourceTree = "<group>";
};
A93252D028809144001EDF50 /* Views */ = {
Expand Down Expand Up @@ -1572,7 +1592,8 @@
EBF66A9F287227F500DE0ED1 /* Common */ = {
isa = PBXGroup;
children = (
A93252BE288086BA001EDF50 /* HelpmeAlerts */,
3B93ED4B2887C5D900240434 /* HelfmeLoading */,
A93252BE288086BA001EDF50 /* HelfmeAlerts */,
EB033E82287B5B6E00C48FB9 /* UI Components */,
EBF66AA0287227F500DE0ED1 /* Base */,
);
Expand Down Expand Up @@ -1880,7 +1901,8 @@
FDC46A23288326AB00F62D20 /* Lottie */ = {
isa = PBXGroup;
children = (
FDC46A24288326AB00F62D20 /* splash_ios.json */,
3B93ED512887CBC500240434 /* loading_iOS.json */,
FDC46A24288326AB00F62D20 /* splash_iOS.json */,
);
path = Lottie;
sourceTree = "<group>";
Expand Down Expand Up @@ -1998,7 +2020,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
FDC46A25288326AC00F62D20 /* splash_ios.json in Resources */,
FDC46A25288326AC00F62D20 /* splash_iOS.json in Resources */,
EB6A44C7287366DF00749582 /* .swiftlint.yml in Resources */,
3B0B25582876BBE400950539 /* NotoSansCJKkr-Bold.otf in Resources */,
3B0B25572876BBE400950539 /* Pretendard-Medium.otf in Resources */,
Expand All @@ -2023,6 +2045,7 @@
EBA8C14428820608009DBA49 /* SupplementMap.storyboard in Resources */,
3B0B25562876BBE400950539 /* Pretendard-Regular.otf in Resources */,
EBF66AD0287227F500DE0ED1 /* Assets.xcassets in Resources */,
3B93ED522887CBC500240434 /* loading_iOS.json in Resources */,
EBF66AD2287227F500DE0ED1 /* LaunchScreen.storyboard in Resources */,
3B9EF0FB2885D340009DEEDE /* GoogleService-Info.plist in Resources */,
A9E593CF2876C26900B0F8B5 /* Color.xcassets in Resources */,
Expand Down Expand Up @@ -2166,6 +2189,7 @@
A90CFDD12885B4E70018AB94 /* SearchResultDataModel.swift in Sources */,
EBA8C1552882ABB4009DBA49 /* AuthService.swift in Sources */,
EBF66AF7287227F500DE0ED1 /* manageObserverAction.swift in Sources */,
3B93ED4E2887C9CB00240434 /* HelfmeLoadingView.swift in Sources */,
FDCD5B452881ACC100EAEF51 /* LocationLiterals.swift in Sources */,
EBF66B05287227F500DE0ED1 /* GeneralResponse.swift in Sources */,
A93252CF2880913F001EDF50 /* HelfmeAlertVC.swift in Sources */,
Expand Down

Large diffs are not rendered by default.

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

import UIKit

import Lottie
import SnapKit

class HelfmeLoadingView: UIView {

// MARK: - Properties

static let shared = HelfmeLoadingView()

// MARK: - UI Components

private var contentView: UIView = {
let view = UIView()
return view
}()

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

return animationView
}()

// MARK: - View Life Cycle

override init(frame: CGRect) {
super.init(frame: frame)
setLayout()
setUI()
}

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

// MARK: - Extension

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

self.contentView.snp.makeConstraints {
$0.center.equalTo(self.safeAreaLayoutGuide)
}
self.loadingView.snp.makeConstraints {
$0.center.equalTo(self.safeAreaLayoutGuide)
}
}

private func setUI() {
self.backgroundColor = UIColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.4)
}

func show() {
guard let window = UIApplication.shared.windows.last else { return }
print("윈도우", window)
window.addSubview(self)

self.snp.makeConstraints {
$0.edges.equalToSuperview()
}
self.layoutIfNeeded()
self.loadingView.play()
UIView.animate(
withDuration: 0.7,
animations: { self.contentView.alpha = 1 }
)
}

func hide(completion: @escaping () -> ()) {
self.loadingView.stop()
self.removeFromSuperview()
completion()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,7 @@ extension HamburgerBarVC {
}

private func setLayout() {
view.addSubviews(hamburgerBarView
)
view.addSubviews(hamburgerBarView)

hamburgerBarView.addSubviews(hellowStackView,
storeButtonStackView, reportButtonStackView,
Expand All @@ -224,11 +223,6 @@ extension HamburgerBarVC {
make.leading.equalTo(hamburgerBarView).inset(20)
}

// editNameButton.snp.makeConstraints { make in
// make.centerY.equalTo(hellowStackView.snp.centerY)
// make.leading.equalTo(hellowStackView.snp.trailing).offset(8)
// }

dividingLineViews[0].snp.makeConstraints { make in
make.width.equalTo(hamburgerBarView)
make.top.equalTo(hellowStackView.snp.bottom).offset(38)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ extension SettingVC {
extension SettingVC {
private func addButtonAction() {
askButton.press(animated: false) {
HelfmeLoadingView.shared.show()

DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
HelfmeLoadingView.shared.hide(){
print("로딩 종료")
}
}
}

withdrawalButton.press(animated: false) {
Expand Down
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 0ba4bda

Please sign in to comment.