OIMlineView.swift (2260B)
1 /* 2 * This file is part of GNU Taler, ©2022-25 Taler Systems S.A. 3 * See LICENSE.md 4 */ 5 /** 6 * @author Marc Stibane 7 */ 8 import SwiftUI 9 import taler_swift 10 import SymLog 11 12 fileprivate let horzSpacing: CGFloat = 20 13 fileprivate let vertSpacing: CGFloat = 10 14 15 @available(iOS 16.4, *) 16 struct OIMlineView: View { 17 private let symLog = SymLogV(0) 18 let stack: CallStack 19 let cash: OIMcash 20 @Binding var amountVal: UInt64 21 // @Binding var tappedVal: UInt64 22 let canEdit: Bool 23 24 @EnvironmentObject private var wrapper: NamespaceWrapper 25 26 var body: some View { 27 // let _ = Self._printChanges() 28 #if DEBUG 29 let debug = 1==0 30 let red = debug ? Color.red : Color.clear 31 let green = debug ? Color.green : Color.clear 32 let blue = debug ? Color.blue : Color.clear 33 let orange = debug ? Color.orange : Color.clear 34 #endif 35 36 let notes = OIMlayoutView(stack: stack.push(), 37 cash: cash, 38 funds: cash.notes(), 39 amountVal: $amountVal, 40 canEdit: canEdit) 41 let coins = OIMlayoutView(stack: stack.push(), 42 cash: cash, 43 funds: cash.coins(), 44 amountVal: $amountVal, 45 canEdit: canEdit) 46 LayoutThatFits([HStackLayout(), VStackLayout()]) { 47 notes 48 #if DEBUG 49 .padding(1) 50 .border(green) 51 #endif 52 coins 53 } 54 #if DEBUG 55 .padding(1) 56 .border(orange) 57 #endif 58 // .onChange(of: tappedVal) { newVal in 59 // if newVal > 0 { 60 // symLog.log(">>tapped \(newVal)") 61 // tappedVal = 0 62 // 63 // DispatchQueue.main.async { // next layout cycle 64 // withAnimation(.move1) { 65 // symLog.log(">>addCash \(newVal)") 66 // cash.addCash(value: newVal) 67 // amountVal += newVal // update directly 68 // } 69 // } 70 // } 71 // } 72 } 73 } 74 75 // MARK: - 76 //#Preview { 77 // OIMlineView() 78 //}