Created
March 11, 2022 14:00
-
-
Save natiginfo/531864b0e0a924cf764d6910133821c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct SwipableCardsView: View { | |
var numbers = (1...5) | |
var body: some View { | |
GeometryReader { geo in | |
TabView { | |
ForEach(numbers, id: \.self) { i in | |
VStack { | |
Image(systemName: "\(i).circle") | |
.resizable() | |
.aspectRatio(contentMode: .fit) | |
.clipped() | |
.padding(50) | |
} | |
.frame(width: geo.size.width - 20, height: geo.size | |
.height / 2, alignment: .center) | |
.background(Color(.sRGB, red: Double.random(in: 0..<1), green: Double.random(in: 0..<1), blue: Double.random(in: 0..<1))) | |
.cornerRadius(20) | |
.shadow(radius: 10) | |
} | |
} | |
.tabViewStyle(PageTabViewStyle(indexDisplayMode: .automatic)) | |
.indexViewStyle(PageIndexViewStyle(backgroundDisplayMode: .always)) | |
} | |
} | |
} | |
struct SwipableCardsView_Previews: PreviewProvider { | |
static var previews: some View { | |
SwipableCardsView() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment