Created
March 22, 2022 09:58
-
-
Save karm435/afd31f77757eb9a7c93ca8b01838339d to your computer and use it in GitHub Desktop.
LazyVStack sample code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(.vertical) { | |
LazyVStack(alignment: .center, spacing: 50) { | |
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