Skip to content

Instantly share code, notes, and snippets.

@Adem68
Last active July 18, 2020 15:01
Show Gist options
  • Save Adem68/79b86853b2961354ad60528e9de9bf05 to your computer and use it in GitHub Desktop.
Save Adem68/79b86853b2961354ad60528e9de9bf05 to your computer and use it in GitHub Desktop.
SwiftUI Profile Card
import SwiftUI
import URLImage
struct ContentView: View {
let photoUrl = URL(string: "https://pbs.twimg.com/profile_images/1235430405848928256/ODfH3uwj_400x400.jpg")
var body: some View {
ScrollView(.vertical, showsIndicators: false) {
VStack(alignment: .center, spacing: 20) {
Spacer()
ZStack {
Circle()
.strokeBorder(AngularGradient(gradient: Gradient(colors: [.yellow, .orange, .red, .purple, .red]), center: .center, startAngle: .degrees(90), endAngle: .degrees(360)), lineWidth: 5)
.clipShape(Circle())
.frame(width: 320, height: 320)
Circle()
.fill(Color(UIColor.systemBackground))
.clipShape(Circle())
.frame(width: 310, height: 310)
URLImage(photoUrl!)
.frame(width: 300, height: 300)
.clipShape(Circle())
}
Text("Adem Furkan ÖZCAN").bold().font(.title)
Button(action: {
UIApplication.shared.open(URL(string: "https://twitter.com/AdemOzcan68")!)
}) {
Image("twitter") // Twitter logo from assets (https://about.twitter.com/en_us/company/brand-resources.html)
.resizable()
.frame(width: 32, height: 32)
Text("Twitter")
}
Button(action: {
UIApplication.shared.open(URL(string: "https://github.com/Adem68")!)
}) {
Image("github") // GitHub logo from assets (https://github-media-downloads.s3.amazonaws.com/GitHub-Mark.zip)
.resizable()
.foregroundColor(Color.primary)
.frame(width: 32, height: 32)
Text("GitHub")
}
Button(action: {
UIApplication.shared.open(URL(string: "https://t.me/Adem68")!)
}) {
Image(systemName: "paperplane.fill")
.frame(width: 32, height: 32)
Text("Telegram")
}
Spacer()
Text("Coded with 💙 in Istanbul").bold().font(.caption)
Spacer()
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
@Adem68
Copy link
Author

Adem68 commented Jul 18, 2020

preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment