ContentView.swift
// // ContentView.swift // Test // // Created by Cairocoders // import SwiftUI struct ContentView: View { var body: some View { NavigationView{ Home().navigationBarTitle("") .navigationBarHidden(true) .navigationBarBackButtonHidden(true) }.preferredColorScheme(.dark) } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } } struct Home : View { @State var txt = "" @State var show = false var body : some View{ VStack(alignment: .leading, spacing: 20){ HStack(spacing: 10){ Button(action: { }) { Image("menu").renderingMode(.original) } Image("logo") Spacer() Button(action: { }) { Image("Notifications").renderingMode(.original) } } HStack(spacing: 15){ Image(systemName: "magnifyingglass").font(.body) TextField("Search For Movies,Shows", text: $txt) }.padding() .background(Color.gray) ScrollView(.vertical, showsIndicators: false) { VStack(alignment: .leading, spacing: 15) { Text("Movies").font(.title) ZStack{ NavigationLink(destination: Detail(show: $show), isActive: $show) { Text("") } Image("top").resizable().onTapGesture { self.show.toggle() } VStack{ Spacer() HStack{ VStack(alignment: .leading, spacing: 10){ Text("Journey 2: The Mysterious Island").font(.body) Text("Action Movie").font(.caption) } Spacer() Button(action: { }) { Image("play").renderingMode(.original) } } }.padding() }.frame(height: 190) HStack{ Spacer() Button(action: { }) { Text("View All") }.foregroundColor(Color.white) } Text("Continue Watching") middleView() BottomView() } }.padding(.bottom, 25) }.padding(.horizontal) .edgesIgnoringSafeArea(.bottom) .preferredColorScheme(.dark) } } struct middleView : View { var body : some View{ VStack(spacing: 15){ ScrollView(.horizontal, showsIndicators: false) { HStack(spacing: 15){ ForEach(datas){i in VStack(alignment: .leading,spacing: 0){ Image(i.image) HStack{ Spacer() Button(action: { }) { Image("play").renderingMode(.original).resizable().frame(width: 25, height: 25) }.padding(.top, -12) } VStack(alignment: .leading){ Text(i.name) ZStack{ Capsule().fill(Color.gray) HStack{ Capsule().fill(Color.green).frame(width: i.percentage) Spacer() } }.frame(height: 5) }.padding(.horizontal,10) .padding(.bottom, 10) }.background(Color.gray) .padding(.bottom) } } } } } } struct BottomView : View { var body : some View{ VStack(alignment: .leading,spacing: 15){ Text("Explore By Genres") HStack{ Button(action: { }) { Text("Action").padding() }.foregroundColor(.white) .background(Color.red) .cornerRadius(10) Spacer(minLength: 10) Button(action: { }) { Text("Adventure").padding() }.foregroundColor(.white) .background(Color.red) .cornerRadius(10) Spacer(minLength: 10) Button(action: { }) { Text("Comedy").padding() }.foregroundColor(.white) .background(Color.red) .cornerRadius(10) } Text("Trending") ScrollView(.horizontal, showsIndicators: false) { HStack(spacing: 15){ ForEach(bottom,id: \.self){i in Image(i) } } } } } }Detail.swift
// // Detail.swift // Test // // Created by Cairocoders // import SwiftUI struct Detail : View { @Binding var show : Bool var body : some View{ VStack(spacing: 15){ HStack(spacing: 15){ Button(action: { self.show.toggle() }) { Image(systemName: "arrow.left").foregroundColor(Color.white) } Spacer() Button(action: { actionSheet() }) { Image("share").renderingMode(.original) } Button(action: { }) { Image(systemName: "info.circle").foregroundColor(Color.white) } }.padding() ZStack{ Image("detail").resizable() VStack(alignment: .leading,spacing: 12){ Spacer() Text("ACTION") Text("Journey 2: The Mysterious Island").font(.title) HStack(spacing: 10){ Text("98% Match") Text("2012") Image("hd") Spacer() } }.padding() }.frame(height: UIScreen.main.bounds.height / 2) .navigationBarTitle("") .navigationBarHidden(true) .navigationBarBackButtonHidden(true) ScrollView(.vertical, showsIndicators: false) { VStack(alignment: .leading, spacing: 15){ HStack{ Button(action: { }) { HStack(spacing: 10){ Image(systemName: "play.fill") Text("Play") }.padding() }.foregroundColor(.white) .background(Color.red) .cornerRadius(10) Button(action: { }) { HStack(spacing: 10){ Image(systemName: "plus") Text("ADD TO LIST") }.padding() }.foregroundColor(.white) .background(Color.gray) .cornerRadius(10) Spacer() } HStack{ VStack(alignment: .leading, spacing: 10){ Text("Journey 2: The Mysterious Island") Text("Sean Anderson partners with his mom's husband on a mission to find his grandfather, who is thought to be missing on a mythical island.").foregroundColor(.gray) } }.padding(.top, 15) Divider().padding(.vertical, 12) ForEach(popular){i in VStack(alignment: .leading,spacing: 15){ HStack{ Image(i.image) .resizable().aspectRatio(contentMode: .fill) VStack(alignment: .leading, spacing: 10){ Text(i.name) Text(i.time) } Spacer() Button(action: { }) { Image(systemName: "arrow.down") } } Text(i.desc) } }.padding(.bottom, 15) } }.padding(.top, 15) .padding(.horizontal, 15) }.edgesIgnoringSafeArea(.bottom) } func actionSheet() { guard let urlShare = URL(string: "https://developer.apple.com/xcode/swiftui/") else { return } let activityVC = UIActivityViewController(activityItems: [urlShare], applicationActivities: nil) UIApplication.shared.windows.first?.rootViewController?.present(activityVC, animated: true, completion: nil) } } struct Detail_Previews: PreviewProvider { @State static var show = false static var previews: some View { Detail(show: $show) } }Model.swift
// // Model.swift // Test // // Created by Cairocoders // import SwiftUI struct type : Identifiable { var id : Int var name : String var image : String var percentage : CGFloat } var datas = [ type(id: 0, name: "The Amazing Spider-Man", image: "1",percentage : 45), type(id: 1, name: "Fast and Furious Presents", image: "2",percentage: 90), type(id: 2, name: "Green Snake", image: "3",percentage: 53) ] var bottom = ["b1","b2"] struct polularlist : Identifiable { var id : Int var name : String var time : String var image : String var desc : String } var popular = [polularlist(id: 0, name: "Green Snake", time: "51 min", image: "3", desc: "While trying to free her sister from Fahai's clutches, Xio Qing winds up in a dystopian city and meets a mysterious man who can't recall his past life."), polularlist(id: 1, name: "How to Train Your Dragon 2", time: "44 min", image: "4", desc: "Five years have passed since Hiccup and Toothless united the dragons and Vikings of Berk. Now, they spend their time charting the island's unmapped territories. During one of their adventures, the pair discover a secret cave that houses hundreds of wild dragons"), polularlist(id: 2, name: "Aquaman", time: "63 min", image: "5", desc: "Once home to the most advanced civilization on Earth, the city of Atlantis is now an underwater kingdom ruled by the power-hungry King Orm. With a vast army at his disposal, Orm plans to conquer the remaining oceanic people -- and then the surface world.")]