yangbongsoo / blockStudy

1 stars 0 forks source link

aries framework swift sample 코드 분석 #40

Open yangbongsoo opened 1 year ago

yangbongsoo commented 1 year ago
//
//  WalletMainView.swift
//  wallet-app-ios
//

import SwiftUI

enum MainMenu: Identifiable {
    case qrcode, list, loading
    var id: Int {
        hashValue
    }
}

struct WalletMainView: View {
    @State var invitation: String = ""
    @StateObject var credentialHandler = CredentialHandler.shared

    var body: some View {
        ZStack {
            NavigationView {
                VStack {
                    List {
                        Button(action: {
                            credentialHandler.menu = .qrcode
                        }) {
                            Text("Connect")
                        }

                        Button(action: {
                            credentialHandler.menu = .list
                        }) {
                            Text("Credentials")
                        }
                    }
                    .navigationTitle("Wallet App")
                    .listStyle(.plain)

                    Spacer()

                    HStack {
                        TextField("invitation url", text: $invitation)
                            .textFieldStyle(.roundedBorder)

                        Button("Clear", action: {
                            invitation = ""
                        })
                        .buttonStyle(.bordered)
                        Button("Connect", action: {
                            QRCodeHandler().receiveInvitation(url: invitation)
                        })
                        .buttonStyle(.bordered)
                    }
                    .padding()
                }
            }
            .sheet(item: $credentialHandler.menu) { item in
                switch item {
                case .qrcode:
                    QRScanView(handler: QRCodeHandler())
                case .list:
                    CredentialListView()
                case .loading:
                    Text("Processing ...")
                }
            }
            .alert(item: $credentialHandler.actionType) { item in
                switch item {
                case .credOffer:
                    return Alert(title: Text("Credential"), message: Text(credentialHandler.confirmMessage), primaryButton: .default(Text("OK"), action: {
                        credentialHandler.getCredential()
                    }), secondaryButton: .cancel())
                case .proofRequest:
                    return Alert(title: Text("Proof"), message: Text(credentialHandler.confirmMessage), primaryButton: .default(Text("OK"), action: {
                        credentialHandler.sendProof()
                    }), secondaryButton: .cancel())
                }
            }
            .alert(credentialHandler.alertMessage, isPresented: $credentialHandler.showAlert) {}
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        WalletMainView()
    }
}
yangbongsoo commented 1 year ago

precompiled 에서 platform.hpp file not found 에러가 왜 발생하는지

스크린샷 2022-12-21 오후 7 15 03

인텔 맥북으로 해도 동일하게 발생함

스크린샷 2022-12-21 오후 10 33 24
yangbongsoo commented 1 year ago

Building on Apple silicon Mac is not supported yet

yangbongsoo commented 1 year ago

cmake 가 깔려있어야함. 근데 brew install cmake 해도 바로 되진 않음 캐시된게 있음 cocoapod 캐시 삭제하고 다시 pod install https://github.com/hyperledger/aries-framework-swift/issues/14#issuecomment-1362291456