`I am also doing the DetailVew And i am getting an error message stating that "compiling failed Cannot find type 'DetailView_Previews' in scope
Here is my code for that. I am not using the starting project files. I am wondering if that is the problem? ``
struct DetailView: View {
let scrum: DailyScrum
var body: some View {
Text("Hello, World!")
}
}
struct DetailView_Previews: PreviewProvider {
static var previews: some View {
DetailView(scrum: DailyScrum.sampleData[0])
}
}
Post
Replies
Boosts
Views
Activity
Maybe it has something to do with me using Xcode 12.5 instead of 13
struct TrailingIconLabelStyle: LabelStyle {
func makeBody(configuration: Configuration) -> some View {
HStack {
configuration.title
configuration.icon
}
}
}
extension LabelStyle where Self == TrailingIconLabelStyle {
static var trailingIcon: Self { Self() }
}
This is the code
I imported the theme folder and that seemed to fix my problem. I am also having a problem with the CardView swift i get this error message. "Cannot infer contextual base in reference to member 'trailingIcon'"
Here is my code. // // CardView.swift // Scrumdinger // // Created by Leonard Assenberg on 6/6/22. //
import SwiftUI
struct CardView: View { let scrum: DailyScrum var body: some View {
VStack(alignment: .leading){
Text(scrum.title) .font(.headline)
.accessibilityAddTraits(.isHeader)
Spacer()
HStack { Label("(scrum.attendees.count)", systemImage: "person.3") .accessibilityLabel("(scrum.attendees.count) attendees")
Spacer()
Label("(scrum.lengthInMinutes)", systemImage: "clock")
.accessibilityLabel("(scrum.lengthInMinutes) minute meeting")
.labelStyle(.trailingIcon) "Cannot infer contextual base in reference to member 'trailingIcon'"
} .font(.caption) }
.padding() .foregroundColor(scrum.theme.accentColor) } }
struct CardView_Previews: PreviewProvider {
static var scrum = DailyScrum.sampleData[0]
static var previews: some View {
CardView(scrum: scrum)
.background(scrum.theme.mainColor)
.previewLayout(.fixed(width: 400, height: 60)) } }
I am assuming the problem is in my TrailingIconLabelStyle.swift. But the code looks good to me.
import SwiftUI
struct TrailingIconLabelStyle: LabelStyle {
func makeBody(configuration: Configuration) -> some View {
HStack { configuration.title configuration.icon } } }
extension LabelStyle where Self == TrailingIconLabelStyle {
static var trailingIcon: Self { Self() } }
Any Suggestions?
I imported the theme folder and that seemed to fix my problem. I am also having a problem with the CardView swift i get this error message. "Cannot infer contextual base in reference to member 'trailingIcon'"
Here is my code.
//
// CardView.swift
// Scrumdinger
//
// Created by Leonard Assenberg on 6/6/22.
//
import SwiftUI
struct CardView: View {
let scrum: DailyScrum
var body: some View {
VStack(alignment: .leading){
Text(scrum.title)
.font(.headline)
.accessibilityAddTraits(.isHeader)
Spacer()
HStack {
Label("(scrum.attendees.count)", systemImage: "person.3")
.accessibilityLabel("(scrum.attendees.count) attendees")
Spacer()
Label("(scrum.lengthInMinutes)", systemImage: "clock")
.accessibilityLabel("(scrum.lengthInMinutes) minute meeting")
.labelStyle(.trailingIcon) "Cannot infer contextual base in reference to member 'trailingIcon'"
}
.font(.caption)
}
.padding()
.foregroundColor(scrum.theme.accentColor)
}
}
struct CardView_Previews: PreviewProvider {
static var scrum = DailyScrum.sampleData[0]
static var previews: some View {
CardView(scrum: scrum)
.background(scrum.theme.mainColor)
.previewLayout(.fixed(width: 400, height: 60))
}
}
I am assuming the problem is in my TrailingIconLabelStyle.swift. But the code looks good to me.
import SwiftUI
struct TrailingIconLabelStyle: LabelStyle {
func makeBody(configuration: Configuration) -> some View {
HStack {
configuration.title
configuration.icon
}
}
}
extension LabelStyle where Self == TrailingIconLabelStyle {
static var trailingIcon: Self { Self() }
}
Any Suggestions?