Avatar
ScrollView(.horizontal) { LazyHGrid(rows: [ GridItem(.fixed(30.0), spacing: 0.0), GridItem(.fixed(30.0), spacing: 0.0), GridItem(.fixed(30.0), spacing: 0.0), GridItem(.fixed(10.0), spacing: 0.0) ], spacing: 0.0) { ForEach(0..<frames, id: \.self) { frame in if framesPerSecond != 0 && frame % Int(framesPerSecond) == 0 { let seconds = Int(Double(frame + 1) / framesPerSecond) Text("\(seconds)") .frame(width: 30.0) } else { Spacer() .frame(width: 30.0) } Text("\(frame)") .frame(width: 30.0) Rectangle() .stroke(lineWidth: 1.0) .frame(width: 30.0) if frame == animationPlayer.currentFrame { Rectangle() .fill(.blue) .frame(width: 30.0) } else { Spacer().frame(width: 30.0) } } } } (edited)
3:34 AM
雑にこんな感じかと...
3:34 AM
rows: で GridItem を使って、縦方向の大きさや空き幅グリッドの数を指定する感じっぽい (edited)