로그인 페이지
This commit is contained in:
15
SodaLive/Sources/Common/ApiResponse.swift
Normal file
15
SodaLive/Sources/Common/ApiResponse.swift
Normal file
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// ApiResponse.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/09.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
struct ApiResponse<T: Decodable>: Decodable {
|
||||
let success: Bool
|
||||
let data: T?
|
||||
let message: String?
|
||||
let errorProperty: String?
|
||||
}
|
69
SodaLive/Sources/Common/LoadingView.swift
Normal file
69
SodaLive/Sources/Common/LoadingView.swift
Normal file
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// LoadingView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/09.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct LoadingView: View {
|
||||
@State var index = 0
|
||||
|
||||
@State var timer = Timer.publish(every: 0.35, on: .current, in: .common).autoconnect()
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
Color.primary.opacity(0.2)
|
||||
.ignoresSafeArea()
|
||||
|
||||
ZStack {
|
||||
Image("loading_1")
|
||||
.resizable()
|
||||
.frame(width: 100, height: 100)
|
||||
.opacity(index == 0 ? 1.0 : 0.0)
|
||||
|
||||
Image("loading_2")
|
||||
.resizable()
|
||||
.frame(width: 100, height: 100)
|
||||
.opacity(index == 1 ? 1.0 : 0.0)
|
||||
|
||||
Image("loading_3")
|
||||
.resizable()
|
||||
.frame(width: 100, height: 100)
|
||||
.opacity(index == 2 ? 1.0 : 0.0)
|
||||
|
||||
Image("loading_4")
|
||||
.resizable()
|
||||
.frame(width: 100, height: 100)
|
||||
.opacity(index == 3 ? 1.0 : 0.0)
|
||||
|
||||
Image("loading_5")
|
||||
.resizable()
|
||||
.frame(width: 100, height: 100)
|
||||
.opacity(index == 4 ? 1.0 : 0.0)
|
||||
}
|
||||
.frame(width: 150, height: 150)
|
||||
.background(Color.white)
|
||||
.cornerRadius(14)
|
||||
.shadow(color: Color.primary.opacity(0.07), radius: 5, x: 5, y: 5)
|
||||
.shadow(color: Color.primary.opacity(0.07), radius: 5, x: -5, y: -5)
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.onReceive(timer) { _ in
|
||||
DispatchQueue.main.async {
|
||||
if index == 4 {
|
||||
index = 0
|
||||
} else {
|
||||
index += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct LoadingView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
LoadingView()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user