-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Fix] #111 - 로그인 화면전환 로딩 인디케이터 구현 및 릴리즈 전 마지막 수정작업
- Loading branch information
Showing
13 changed files
with
162 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
SOPT-Stamp-iOS/Projects/Modules/DSKit/Sources/Components/CustomLoadingView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// | ||
// CustomLoadingView.swift | ||
// DSKit | ||
// | ||
// Created by Junho Lee on 2023/01/12. | ||
// Copyright © 2023 SOPT-Stamp-iOS. All rights reserved. | ||
// | ||
|
||
import Combine | ||
import UIKit | ||
|
||
import Core | ||
|
||
import SnapKit | ||
|
||
public extension UIViewController { | ||
var isLoading: Bool { | ||
get { return CustomLoadingView.shared.isLoading } | ||
set(startLoading) { | ||
if startLoading { | ||
CustomLoadingView.shared.show(self.view) | ||
} else { | ||
CustomLoadingView.shared.hide() | ||
} | ||
} | ||
} | ||
|
||
func showLoading() { | ||
self.isLoading = true | ||
} | ||
|
||
func stopLoading() { | ||
self.isLoading = false | ||
} | ||
} | ||
|
||
public class CustomLoadingView: UIView { | ||
|
||
// MARK: - Properties | ||
|
||
public static let shared = CustomLoadingView() | ||
public var isLoading: Bool { | ||
return self.activityIndicator.isAnimating | ||
} | ||
|
||
// MARK: - UI Components | ||
|
||
lazy var activityIndicator: UIActivityIndicatorView = { | ||
let activityIndicator = UIActivityIndicatorView() | ||
activityIndicator.frame = CGRect(x: 0, y: 0, width: 50, height: 50) | ||
activityIndicator.hidesWhenStopped = false | ||
activityIndicator.style = .large | ||
activityIndicator.tintColor = .white | ||
return activityIndicator | ||
}() | ||
|
||
// MARK: - View Life Cycle | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
configureUI() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
} | ||
|
||
// MARK: - Extension | ||
|
||
extension CustomLoadingView { | ||
private func configureUI() { | ||
self.addSubview(activityIndicator) | ||
} | ||
|
||
public func show(_ view: UIView) { | ||
view.addSubview(self) | ||
|
||
UIView.animate(withDuration: 0.3, delay: 0.05) { | ||
self.backgroundColor = .black.withAlphaComponent(0.55) | ||
} | ||
|
||
self.snp.makeConstraints { | ||
$0.edges.equalToSuperview() | ||
} | ||
self.activityIndicator.center = view.center | ||
self.layoutIfNeeded() | ||
self.activityIndicator.startAnimating() | ||
} | ||
|
||
public func hide(completion: (() -> Void)? = nil) { | ||
self.backgroundColor = .clear | ||
self.activityIndicator.stopAnimating() | ||
self.removeFromSuperview() | ||
completion?() | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
SOPT-Stamp-iOS/Projects/Modules/Network/Sources/Entity/SignUpResponse.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// SignUpResponse.swift | ||
// Network | ||
// | ||
// Created by Junho Lee on 2023/01/13. | ||
// Copyright © 2023 SOPT-Stamp-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
import Foundation | ||
|
||
public struct SignUpResponse: Codable{ | ||
public let userId: Int | ||
|
||
init(userId: Int) { | ||
self.userId = userId | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters