Skip to content

Unable to run a ForEach loop into it  #9

@HabboCodes

Description

@HabboCodes

Been looking for something like this for ages tonight but ive found an annoying bug? when I run the ForEach with the code below the marquee restarts the instant the first text hits the edge of the frame.

Im trying to create a Marquee of game resutls but the second the edge of the first one hits the edge of the box it restarts the loop.

Marquee { HStack{ ForEach(function.lastTen(), id: \.matchRecord.id) {index in HStack { Text("\(function.playerName(for: index.matchRecord.playerId))") Text("VS") Text("\(index.winnerName)") Image(systemName: "trophy.fill") } .padding(.trailing, 50) .font(.system(size: 20)) .foregroundColor(.white) } } } .frame(width: 200, height: 50) .background(Color.mint.opacity(0.8)) .marqueeDuration(duration)

If I run the code below without the external HStack however it loops round perfectlly like expected, but now my ForEach loop is displaying stacked ontop of each other not horizontally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions