Advertisement
modelist61

Найди 2 ошибки

Oct 25th, 2023
1,084
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 2.42 KB | None | 0 0
  1. import SwiftUI
  2.  
  3. struct BarriersView: View {
  4.     // MARK: Properties
  5.  
  6.     @ObservedObject let viewModel: MainScreenViewModel
  7.  
  8.     // MARK: UI
  9.  
  10.     var body: some View {
  11.         if viewModel.addressesSource.isEmpty {
  12.             if viewModel.isLoading {
  13.                 DarkProgressView()
  14.                     .frame(height: 100)
  15.             } else {
  16.                 HelperLabel(text: Localization.Main.noDeviceHelperTitle)
  17.                     .padding(.horizontal, 16)
  18.             }
  19.         } else {
  20.             if viewModel.isLoadingDevices {
  21.                 DarkProgressView()
  22.                     .frame(height: 100)
  23.             }
  24.  
  25.             let barriers = viewModel.barrierSource
  26.  
  27.             ForEach(barriers) { barrierSource in
  28.                 VStack(alignment: .leading) {
  29.                     Text(barrierSource.location)
  30.                         .foregroundColor(Colors.Neutral.neutral500.color)
  31.                         .textStyle(.body13reg)
  32.                         .frame(maxWidth: .infinity, alignment: .leading)
  33.  
  34.                     ZStack {
  35.                         ListBackground()
  36.                         VStack {
  37.                             ForEach(barrierSource.barriers, id: \.0) { index, barrier in
  38.                                 let lastIndex = barrierSource.barriers.count - 1
  39.                                 let isOuterPadding = index == 0 || index == lastIndex
  40.                                 let isAvailable = barrier.isAvailable
  41.  
  42.                                 DoorRow(
  43.                                     title: barrier.title,
  44.                                     isAvailable: true,
  45.                                     sipPanelId: barrier.deviceId
  46.                                 ) {}
  47.                                     .padding(
  48.                                         EdgeInsets(
  49.                                             top: isOuterPadding ? 20 : 16,
  50.                                             leading: 0,
  51.                                             bottom: isOuterPadding ? 20 : 16,
  52.                                             trailing: 0
  53.                                         )
  54.                                     )
  55.                                     .disabled(!isAvailable)
  56.                             }
  57.                         }
  58.                     }
  59.                 }
  60.                 .padding(.top, 24)
  61.             }
  62.             .padding(.horizontal, 16)
  63.         }
  64.     }
  65. }
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement