Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import SwiftUI
- struct ContentView : View {
- let sample = Story.sample
- var body: some View {
- ScrollView {
- HStack(spacing: 16) {
- Spacer()
- ForEach(sample) { story in
- VStack {
- Circle().fill(story.profile)
- .frame(width: 50, height: 50)
- .overlay(Circle().scale(1.2).stroke(Color.purple))
- Text(story.username)
- }
- }
- Spacer()
- }
- }
- }
- }
- struct Story : Identifiable {
- let id: Int
- let username: String
- let profile: Color
- static var sample: [Story] {
- return [Story(id: 0, username: "alice", profile: .blue),
- Story(id: 1, username: "bob", profile: .red),
- Story(id: 2, username: "carol", profile: .gray),
- Story(id: 3, username: "david", profile: .yellow),
- Story(id: 4, username: "enoch", profile: .black),
- Story(id: 5, username: "francis", profile: .green),
- Story(id: 6, username: "garth", profile: .pink)
- ]
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement