This is my code and I haven't changed it. This is used to run on both 18.2 and 18.4. Also it didn't happened on 18.3. I have provided a screenshot also.
| struct PracticeScreen: View { |
| @EnvironmentObject private var vm: HomeViewModel |
| @AppStorage("count") private var count = 0 |
| @AppStorage("round") private var round = 0 |
| @State private var showDialog = false |
| @State private var showComplete = false |
| private let totalCount = 108 |
| |
| var body: some View { |
| ZStack { |
| Color(UIColor.systemGroupedBackground) |
| .ignoresSafeArea() |
| |
| if case .active = vm.status, !vm.todayCompleted { |
| VStack { |
| Text(vm.currentPrayer?.day.desc ?? "") |
| .font(.title3) |
| .fontWeight(.medium) |
| .foregroundStyle(.accent) |
| .padding(.bottom, 4) |
| |
| Text(vm.currentPrayer?.mantra ?? "") |
| .lineLimit(2, reservesSpace: true) |
| .multilineTextAlignment(.center) |
| .font(.system(size: 40, weight: .bold, design: .rounded)) |
| |
| Spacer() |
| |
| |
| Text("\(count.toMyanmarDigits())") |
| .font(.system(size: 40, weight: .bold, design: .rounded)) |
| .monospaced() |
| .foregroundStyle(.accent) |
| |
| Button { |
| addCount() |
| } label: { |
| ZStack { |
| Circle() |
| .stroke(.accent, lineWidth: 10) |
| .frame(width: 250, height: 250) |
| |
| Circle() |
| .fill( |
| .accent.opacity(0.5) |
| ) |
| .frame(width: 230, height: 230) |
| |
| Text("Count") |
| .font(.system(size: 36, weight: .bold)) |
| .foregroundStyle(.accent) |
| } |
| } |
| .buttonStyle(PressableButtonStyle()) |
| |
| Spacer() |
| |
| HStack(spacing: 20) { |
| Text("အပတ်ရေ: \(round.toMyanmarDigits()) /\((vm.currentPrayer?.rounds ?? 0).toMyanmarDigits())") |
| .font(.footnote) |
| .foregroundStyle(.white) |
| .padding(.horizontal, 10) |
| .padding(.vertical, 12) |
| .frame(maxWidth: .infinity) |
| .background( |
| Capsule() |
| .fill(.accent) |
| ) |
| |
| Button { |
| showDialog.toggle() |
| } label: { |
| Image(systemName: "arrow.clockwise") |
| .font(.footnote) |
| .foregroundStyle(.white) |
| .padding(12) |
| .background( |
| Circle() |
| .fill() |
| ) |
| } |
| |
| Text("Count: \(count.toMyanmarDigits()) /\(totalCount.toMyanmarDigits())") |
| .font(.footnote) |
| .foregroundStyle(.white) |
| .padding(.horizontal, 10) |
| .padding(.vertical, 12) |
| .frame(maxWidth: .infinity) |
| .background( |
| Capsule() |
| .fill(.accent) |
| ) |
| } |
| } |
| .padding() |
| .padding(.bottom) |
| } else { |
| NoticeCard(status: vm.status) |
| } |
| } |
| .confirmationDialog("အဓိဌာန် အစမှ ပြန်စမလား?", isPresented: $showDialog, titleVisibility: .visible) { |
| Button("အစမှ ပြန်စမည်။", role: .destructive, action: resetCount) |
| Button("မလုပ်တော့ပါ", role: .cancel, action: {}) |
| } |
| .alert("ဒီနေ့ အဓိဌာန် ပြီးဆုံးပါပြီ", isPresented: $showComplete) { |
| Button("ပြီးဆုံးပါပြီ") { |
| vm.markTodayComplete() |
| } |
| |
| Button("မလုပ်တော့ပါ", role: .destructive, action: {}) |
| } |
| .navigationTitle("ဒီနေ့ အဓိဌာန်") |
| .navigationBarTitleDisplayMode(.inline) |
| .toolbar { |
| if case .active = vm.status, !vm.todayCompleted { |
| ToolbarItem(placement: .topBarTrailing) { |
| Button("ပြီးဆုံးပါပြီ") { |
| showComplete.toggle() |
| } |
| } |
| } |
| } |
| } |
| } |
