Advertisement
dartmeadow

stack update from stkusr:nok

Oct 1st, 2021
567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 7.96 KB | None | 0 0
  1. struct Option: Hashable, Identifiable {
  2.     // Identifier for Option !! MUST be unique
  3.     let id: Int
  4.     let title: String
  5.     let imageName: String
  6. }
  7. struct ContentView: View {
  8.     @State var currentOption: Int = 0
  9.    
  10.     let options: [Option] = [
  11.         .init(id: 1, title: "DART Meadow", imageName: "sun.max.fill"),
  12.         .init(id: 2, title: "Research", imageName: "flame"),
  13.         .init(id: 3, title: "Navigation", imageName: "moon.stars.fill"),
  14.         .init(id: 4, title: "Shelf", imageName: "archivebox"),
  15.         .init(id: 5, title: "Chest", imageName: "shippingbox"),
  16.         .init(id: 6, title: "Crate", imageName: "bonjour"),
  17.         .init(id: 7, title: "Manufactoring", imageName: "gear"),
  18.         .init(id: 8, title: "Warehouse", imageName: "archivebox.fill"),
  19.         .init(id: 9, title: "Journal", imageName: "note.text"),
  20.        
  21.        
  22.     ]
  23.    
  24.     var body: some View {
  25.        
  26.        
  27.         VStack(alignment: .leading) {
  28.             HStack(alignment: .top) {
  29.                
  30.                 NavigationView{
  31.                     ListView(options: options, currentSelection: $currentOption)
  32.                    
  33.                     switch (currentOption) {
  34.                        
  35.                     case 1:
  36.                        
  37.                         MainView()
  38.                        
  39.                     case 2:
  40.                         ScrollView( .vertical) {
  41.                             OrbitNodeView()
  42.                             Content2View()
  43.                         }
  44.                     case 3:
  45.                         ScrollView( .vertical) {
  46.                             ATM26NodeView()
  47.                         }
  48.                     case 4:
  49.                         ScrollView( .vertical) {
  50.                             NozzleNodeView()
  51.                         }
  52.                     case 5:
  53.                         ScrollView( .vertical) {
  54.                             Text("Chest")
  55.                                 .font(.largeTitle)
  56.                                 .bold()
  57.                                 .colorInvert()
  58.                                 .padding(.top, 60)
  59.                         }
  60.                     case 6:
  61.                         ScrollView( .vertical) {
  62.                             Text("Crate")
  63.                                 .font(.largeTitle)
  64.                                 .bold()
  65.                                 .colorInvert()
  66.                                 .padding(.top, 60)
  67.                         }
  68.                     case 7:
  69.                         ScrollView( .vertical) {
  70.                             Text("Manufactoring")
  71.                                 .font(.largeTitle)
  72.                                 .bold()
  73.                                 .colorInvert()
  74.                                 .padding(.top, 60)
  75.                         }
  76.                     case 8:
  77.                         ScrollView( .vertical) {
  78.                             Text("Warehouse")
  79.                                 .font(.largeTitle)
  80.                                 .bold()
  81.                                 .colorInvert()
  82.                                 .padding(.top, 60)
  83.                         }
  84.                     case 9:
  85.                         WebView()
  86.                     default:
  87.                        
  88.                         MainView()
  89.                     }
  90.                    
  91.                 }.background(Color.white)
  92.                
  93.             }
  94.         }
  95.         Spacer()
  96.     }
  97. }
  98.  
  99.  
  100.  
  101.  
  102. struct MainView: View {
  103.    
  104.     var body: some View{
  105.         VStack(alignment: .leading) {
  106.             HStack(alignment: .bottom) {
  107.                
  108.                
  109.                 Image("CotharticrenArcLakeWhiteW900")
  110.                     .shadow(radius: 6)
  111.                
  112.             }
  113.         }.frame(width: 900, height: 800, alignment: .center)
  114.             .background(Color.white)
  115.        
  116.         Spacer()
  117.        
  118.        
  119.     }
  120.    
  121. }
  122.  
  123. struct ListView: View {
  124.     let options: [Option]
  125.     @Binding var currentSelection: Int
  126.    
  127.     var body: some View{
  128.         VStack(alignment: .leading) {
  129.             HStack(alignment: .top) {
  130.                 HStack(alignment: .top) {
  131.                     VStack(alignment: .trailing) {
  132.                         Circle()
  133.                             .stroke(Color.init(red: 0.9, green: 0.95, blue: 0.2, opacity: 1), lineWidth: 2)
  134.                             .alignmentGuide(HorizontalAlignment.myAlignment)
  135.                         { d in d[.leading] }
  136.                         .alignmentGuide(VerticalAlignment.myAlignment)
  137.                         { d in d[.bottom] }
  138.                         .frame(width: 50, height: 50)
  139.                        
  140.                         Circle()
  141.                             .stroke(Color.init(red: 0.25, green: 0.9, blue: 0.2, opacity: 1), lineWidth: 2)
  142.                             .alignmentGuide(HorizontalAlignment.myAlignment)
  143.                         { d in d[.leading] }
  144.                         .alignmentGuide(VerticalAlignment.myAlignment)
  145.                         { d in d[.bottom] }
  146.                         .frame(width: 25, height: 25)
  147.                         VStack(alignment: .leading) {
  148.                             Circle()
  149.                                 .stroke(Color.init(red: 0.1, green: 0.1, blue: 1, opacity: 1), lineWidth: 2)
  150.                                 .alignmentGuide(HorizontalAlignment.myAlignment)
  151.                             { d in d[.leading] }
  152.                             .alignmentGuide(VerticalAlignment.myAlignment)
  153.                             { d in d[.bottom] }
  154.                             .frame(width: 75, height: 75)
  155.                         }
  156.                     }
  157.                 }
  158.                
  159.                 HStack(alignment: .top) {
  160.                     Image("DARTMeadowCSMwidthArtemis2by1")
  161.                    
  162.                         .shadow(radius: 3)
  163.                         .padding(.top, 10)
  164.                 }
  165.                
  166.                
  167.                 .padding(.top, 20)
  168.                
  169.                
  170.                 .padding(.trailing, 10)
  171.             }.padding(.top, 20).padding(.leading, 10)
  172.            
  173.             HStack(alignment: .center) {
  174.                 VStack(alignment: .center) {
  175.                    
  176.                     Image("arrow300")
  177.                     HStack(alignment: .center) {
  178.                         Text("You've never plotted an Edge?")
  179.                     }
  180.                 }
  181.             }.shadow(radius: 3)
  182.            
  183.             //Menu
  184.             VStack(alignment: .leading) {
  185.                 ForEach(options, id: \.self) {option in
  186.                     HStack {
  187.                         Image(systemName: option.imageName)
  188.                             .frame(width: 20)
  189.                        
  190.                         Text(option.title)
  191.                         // Don't even have to use current = options[currentSelection] anymore:
  192.                             .foregroundColor(currentSelection == option.id ? .accentColor : .primary)
  193.                     }
  194.                     .padding(8)
  195.                     .onTapGesture {
  196.                         // Set the currentSelection to the ID of the option
  197.                         currentSelection = option.id
  198.                     }
  199.                 }
  200.             }
  201.            
  202.         }.frame(width: 200, height: 800, alignment: .center)
  203.        
  204.        
  205.        
  206.        
  207.     }
  208. }
  209.  
  210. struct WebView: View {
  211.    
  212.     var body: some View{
  213.         VStack(alignment: .center) {
  214.             Text("Journal")
  215.                 .font(.largeTitle)
  216.                 .bold()
  217.                 .colorInvert()
  218.                 .padding(.top, 60)
  219.             HStack(alignment: .bottom) {
  220.                
  221.                
  222.                 Image("articrenmeadowopacity")
  223.                     .shadow(radius: 3)
  224.             }
  225.         }.frame(width: 900, height: 800, alignment: .center)
  226.             .background(Color.white)
  227.        
  228.         Spacer()
  229.     }
  230.    
  231. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement