Skip to content

Instantly share code, notes, and snippets.

@karm435
Created March 22, 2022 09:56
Show Gist options
  • Save karm435/bb19165f38989a1cacc3f0a5a14cb3ce to your computer and use it in GitHub Desktop.
Save karm435/bb19165f38989a1cacc3f0a5a14cb3ce to your computer and use it in GitHub Desktop.
HStack example
import SwiftUI
struct CustomText: View {
private let index: Int
init(index: Int) {
print("init CustomText \(index)")
self.index = index
}
var body: some View {
Text("This is custom text view")
}
}
struct ContentView: View {
var body: some View {
ScrollView(.horizontal) {
LazyHStack {
ForEach(0...100, id:\.self) { index in
CustomText(index: index)
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment