-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
108 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// JSONFile.swift | ||
// | ||
// | ||
// Created by heerucan on 2023/02/14. | ||
// | ||
|
||
import Foundation | ||
|
||
public class JSONFile { | ||
static public func read(resource: String) -> Any? { | ||
if let path = Bundle.module.path(forResource: resource, ofType: "json") { | ||
do { | ||
let data = try Data(contentsOf: URL(fileURLWithPath: path), options: []) | ||
let jsonResult = try JSONSerialization.jsonObject(with: data, options: []) | ||
return jsonResult | ||
} catch { | ||
return nil | ||
} | ||
} else { | ||
return nil | ||
} | ||
} | ||
} |
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,63 @@ | ||
// | ||
// WALLoadingView.swift | ||
// | ||
// | ||
// Created by heerucan on 2023/02/13. | ||
// | ||
|
||
import UIKit | ||
|
||
import Lottie | ||
import SnapKit | ||
|
||
final public class WALLoadingView: UIView { | ||
|
||
// MARK: - Property | ||
|
||
public var loadingAnimationView = LottieAnimationView(name: "loading") | ||
|
||
// MARK: - Initializer | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: .zero) | ||
configureUI() | ||
setupLayout() | ||
play() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
// MARK: - Configure UI & Layout | ||
|
||
private func configureUI() { | ||
self.backgroundColor = .black100.withAlphaComponent(0) | ||
} | ||
|
||
private func setupLayout() { | ||
self.addSubview(loadingAnimationView) | ||
|
||
loadingAnimationView.snp.makeConstraints { make in | ||
make.center.equalToSuperview() | ||
make.width.height.equalTo(100) | ||
} | ||
} | ||
|
||
// MARK: - Custom Method | ||
|
||
public func play() { | ||
UIView.animate(withDuration: 0.3, delay: 0, options: .curveEaseIn, animations: { | ||
self.backgroundColor = .black100.withAlphaComponent(0.5) | ||
self.loadingAnimationView.play() | ||
self.loadingAnimationView.loopMode = .loop | ||
}) | ||
} | ||
|
||
public func hide() { | ||
UIView.animate(withDuration: 0.3, delay: 0, options: .transitionCrossDissolve, animations: { | ||
self.loadingAnimationView.stop() | ||
self.loadingAnimationView.removeFromSuperview() | ||
}) | ||
} | ||
} |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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