Post

Replies

Boosts

Views

Activity

Scrumdinger, Create the Card View
Hi! I'm learning Swift from Apples Tutorials. Right now I'm doing the Scrumdinger tutorial and I'm following the steps to create the app. But right now I get the following errors when I'm creating the CardView. Static property 'sampleData' is not a member type of 'DailyScrum' Array types are now written with the brackets around the element type This is my code: import Foundation struct DailyScrum {     var title: String     var attendees: [String]     var lengthInMinutes: Int     var theme: Theme } extension DailyScrum {     static let sampleData: [DailyScrum] = [         DailyScrum(title: "Design", attendees: ["Chris, Hans"], lengthInMinutes: 10, theme: .yellow),         DailyScrum(title: "Frontend", attendees: ["Daniel, Maria"], lengthInMinutes: 10, theme: .yellow),         DailyScrum(title: "Backend", attendees: ["Fred, Helen"], lengthInMinutes: 10, theme: .yellow)     ] } import SwiftUI struct CardView: View {     let scrum: DailyScrum     var body: some View {         Text("Hello, World!")     } } struct CardView_Previews: PreviewProvider {     static var scrum: DailyScrum.sampleData[0]     static var previews: some View {         CardView(scrum: scrum)     } } Has the language changed since the tutorial was written? Any advice on how I shall proceed? Best regards, Fredrik
3
0
471
Jun ’22