Copying the Code from the Developer App

I have tried to copy the code from a WWDC 2022 presentation. It worked successfully once, and now I am trying to copy a different point of code later in the same presentation. It keeps giving me the code that I have already copied.

Any ideas on how to get this to work would be great!

Thank you,

Bob

Accepted Reply

Thank you for pasting that code. I don't understand what I may be doing wrong.

  • Great. Don't forget to close the thread on the correct answer.

  • Thanks for feedback. But correct answer is not your acknowledge, it is the real answer…

Add a Comment

Replies

How could we help with so little information ?

  • Which WWDC presentation ?
  • Which code is copied without problem
  • Which other is not copied ?

So to answer your questions:

1). What's new in SwiftUI? WWDC 2022.

2). I am able to copy the code at 28:49 regarding the new Shape Styles Icon Grid.

3). At 32:04 When I copy the code on Layout: Seating Chart Layout, and then paste it into a project. Only the code that was copied for the new Shape Styles Icon Grid pastes.

I have cleared the clipboard using the Terminal, restarted my Mac and the Developer App.

So far I have not been able to make this work.

Bob

You should have todl you access with developer app…

I copied at 28'49"

struct Icon: View {
    let systemSymbolName: String
    let color: Color
    let shadow: ShadowStyle
    var foregroundColor: Color = .white

    var body: some View {
        VStack {
            Image(systemName: systemSymbolName)
                .resizable()
                .aspectRatio(1.0, contentMode: .fit)
                .padding(2)
        }
        .background(in: Circle().inset(by: -20))
        .backgroundStyle(
            color
            .gradient
        )
        .foregroundStyle(foregroundColor.shadow(shadow))
        .padding(20)
    }
}

private let dropStyle = ShadowStyle.drop(radius: 1, y: 1.5)
private let innerStyle = ShadowStyle.inner(radius: 1.5)

let icons: [Icon]  = [
    Icon(systemSymbolName: "person", color: .red, shadow: dropStyle),
    Icon(systemSymbolName: "basketball", color: .orange, shadow: dropStyle),
    Icon(systemSymbolName: "globe.central.south.asia", color: .yellow, shadow: innerStyle),
    Icon(systemSymbolName: "carrot", color: .green, shadow: innerStyle, foregroundColor: .orange),
    Icon(systemSymbolName: "sailboat", color: .mint, shadow: innerStyle),
    Icon(systemSymbolName: "figure.open.water.swim", color: .teal, shadow: dropStyle),
    Icon(systemSymbolName: "ladybug.fill", color: .cyan, shadow: innerStyle),
    Icon(systemSymbolName: "calendar", color: .blue, shadow: dropStyle),
    Icon(systemSymbolName: "moon.stars", color: .indigo, shadow: dropStyle),
    Icon(systemSymbolName: "brain.head.profile", color: .purple, shadow: innerStyle),
    Icon(systemSymbolName: "birthday.cake", color: .pink, shadow: dropStyle),
    Icon(systemSymbolName: "house.circle.fill", color: .white, shadow: dropStyle),
    Icon(systemSymbolName: "lizard", color: .brown, shadow: dropStyle),
    Icon(systemSymbolName: "flag.checkered", color: .black, shadow: dropStyle),
    Icon(systemSymbolName: "character.book.closed", color: .gray, shadow: dropStyle),
]

struct IconGrid: View {
    var body: some View {
        Grid(horizontalSpacing: 16, verticalSpacing: 16) {
            ForEach(0..<3) { i in
                GridRow {
                    ForEach(0..<5) { j in
                        icons[i * 5 + j]
                    }
                }
            }
        }
        .background(.black.opacity(0.8))
    }
}

And at 32'04": but this is too much, so I copy in attached file.

I do not understand the problem you have…

Thank you for pasting that code. I don't understand what I may be doing wrong.

  • Great. Don't forget to close the thread on the correct answer.

  • Thanks for feedback. But correct answer is not your acknowledge, it is the real answer…

Add a Comment