1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | // // ContentView.swift // Test // // Created by Cairocoders // import SwiftUI struct ContentView: View { @State var progressValue: Float = 0.0 var body: some View { GeometryReader { geometry in ZStack { Image( "bg" ) .resizable() .aspectRatio(geometry.size, contentMode: .fill) .edgesIgnoringSafeArea(.all) VStack(spacing: 25){ Image( "trophy" ) .resizable() .aspectRatio(contentMode: .fit) .frame(width: 250, height: 250) Text( "Well Done !!!" ) .font(.title) .fontWeight(.heavy) .foregroundColor(.black) // Score And Back To Home Button... HStack(spacing: 15){ Image(systemName: "checkmark" ) .font(.largeTitle) .foregroundColor(.green) Text( "23" ) .font(.largeTitle) .foregroundColor(.black) Image(systemName: "xmark" ) .font(.largeTitle) .foregroundColor(.red) .padding(.leading) Text( "12" ) .font(.largeTitle) .foregroundColor(.black) } Button(action: { }, label: { HStack { Image(systemName: "house.circle" ) .font(.largeTitle) Text( "Goto Home" ) .fontWeight(.heavy) .foregroundColor(.white) .padding(.vertical) .frame(width: UIScreen.main.bounds.width - 150) } .background(Color.blue) .foregroundColor(.white) .cornerRadius(15) }) } } } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } } |
article
Wednesday, June 23, 2021
SwiftUI fullscreen image background using GeometryReader and ZStack
SwiftUI fullscreen image background using GeometryReader and ZStack
ContentView.swift