forked from AcaMate/AcaMate_iOS
64 lines
1.5 KiB
Swift
64 lines
1.5 KiB
Swift
//
|
|
// ContentView.swift
|
|
// AcaMate
|
|
//
|
|
// Created by Sean Kim on 11/26/24.
|
|
//
|
|
|
|
import SwiftUI
|
|
import Combine
|
|
|
|
private var cancellables = Set<AnyCancellable>()
|
|
|
|
struct ContentView: View {
|
|
|
|
|
|
var body: some View {
|
|
VStack {
|
|
Image(systemName: "globe")
|
|
.imageScale(.large)
|
|
.foregroundStyle(.tint)
|
|
Text("Hello, world!")
|
|
.background(Color("Point/Dark"))
|
|
Button {
|
|
SNSLogin().login(type: .Kakao)
|
|
|
|
// self.versionCheck()
|
|
|
|
} label : {
|
|
Text("카카오")
|
|
}
|
|
|
|
}
|
|
.padding()
|
|
}
|
|
|
|
func versionCheck() {
|
|
loadAPIData(url: "https://devacamate.ipstein.myds.me",
|
|
path: "/api/v1/in/app/version",
|
|
method: .get,
|
|
parameters: [ "type": "I"],
|
|
decodingType: APIResponse<VersionData>.self)
|
|
.sink { completion in
|
|
switch completion {
|
|
case .failure(let error):
|
|
printLog("ERROR: \(error)")
|
|
case .finished:
|
|
printLog("Version call Successed")
|
|
}
|
|
} receiveValue: { data in
|
|
guard let responseData = data as? APIResponse<VersionData> else {return}
|
|
printLog(responseData.status.toStringDict())
|
|
printLog(responseData.data.toStringDict())
|
|
}
|
|
.store(in: &cancellables)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
#Preview {
|
|
ContentView()
|
|
}
|