Last active
July 1, 2021 15:23
-
-
Save 0rientd/6e097fc7151680f37a37b99b67c8a4b8 to your computer and use it in GitHub Desktop.
Credit Card in SwiftUI
This file contains 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
// | |
// ContentView.swift | |
// creditCard | |
// | |
// Created by 0rientd on 17/06/21. | |
// | |
import SwiftUI | |
import PlaygroundSupport | |
struct ContentView : View { | |
var body: some View { | |
ZStack { | |
Color.yellow | |
.opacity(0.1) | |
RoundedRectangle(cornerRadius: 15) | |
.fill( | |
LinearGradient(gradient: Gradient(colors: [.blue, .green]), startPoint: .topLeading, endPoint: .bottomTrailing) | |
) | |
.frame(width: 400, height: 250) | |
VStack { | |
Text("SwiftUI Bank") | |
.bold() | |
.foregroundColor(.white) | |
.font(.title) | |
.padding(.bottom, 20) | |
.padding(.trailing, 190) | |
HStack { | |
Image(uiImage: #imageLiteral(resourceName: "Foto.png")) | |
.resizable() | |
.frame(width: 50, height: 40, alignment: .center) | |
.padding(.trailing, -15) | |
ForEach(2..<5) { i in | |
ZStack { | |
Circle() | |
.trim(from: 0.2 - CGFloat((Double(i) / 10.0 - 0.19)), to: 0.3 + CGFloat((Double(i) / 10.0 - Double(i) / 10.0))) | |
.stroke(style: StrokeStyle(lineWidth: CGFloat(i), lineCap: .round, lineJoin: .round)) | |
.foregroundColor(Color.white) | |
.frame(width: 30, height: 30, alignment: .leading) | |
.rotationEffect(.degrees((-105 + Double(i) * 10.0))) | |
.padding(-14) | |
} | |
} | |
} | |
.padding(.bottom, 70) | |
.padding(.trailing, 230) | |
HStack { | |
Text("CARLOS BARROS JR") | |
.bold() | |
.foregroundColor(.white) | |
.font(.system(size: 15)) | |
.padding(.trailing, 125) | |
Text("VISA") | |
.bold() | |
.foregroundColor(.white) | |
.font(.title) | |
} | |
} | |
} | |
} | |
} | |
PlaygroundPage.current.setLiveView(ContentView()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code was written in Playgrounds for iPad.