Skip to content

Commit

Permalink
[Fix/#288] 백그라운드 스레드에서 UI접근하는 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanMinsung committed Nov 17, 2024
1 parent 1e34cfc commit 19d767e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 4 additions & 5 deletions Offroad-iOS/Offroad-iOS/Global/Extensions/UIView+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,12 @@ extension UIView {


func startLoading(withoutShading: Bool = false) {
// 이미 로딩중인 경우, 추가 로딩 뷰 띄우는 것 방지
for subView in subviews {
if subView is LoadingView { return }
}

DispatchQueue.main.async { [weak self] in
guard let self else { return }
// 이미 로딩중인 경우, 추가 로딩 뷰 띄우는 것 방지
for subView in subviews {
if subView is LoadingView { return }
}
let loadingView = LoadingView()
loadingView.shadeView.isHidden = withoutShading
loadingView.isHidden = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ extension CharacterChatLogViewController {
}

private func requestChatLogDataSource() {
tabBarController?.view.startLoading()
DispatchQueue.main.async { [weak self] in
guard let self else { return }
self.tabBarController?.view.startLoading()
}
NetworkService.shared.characterChatService.getChatLog(completion: { [weak self] result in
guard let self else { return }
self.tabBarController?.view.stopLoading()
Expand Down

0 comments on commit 19d767e

Please sign in to comment.