Last active
June 24, 2020 11:49
-
-
Save prafullakumar/2afb8236c93527b08693cd598f75db68 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Row { | |
var value: Int | |
init(value: Int) { | |
print("INIT: \(value)") // see init calls with scroll in case of lazy loading | |
self.value = value | |
} | |
} | |
struct ContentView: View { | |
var body: some View { | |
NavigationView { | |
ScrollView(.vertical){ //.horizontal for Horizontal scaoll | |
LazyVStack(alignment: .leading) { //LazyHStack for Horizontal layout | |
ForEach(1...50, id: \.self) { i in | |
Text("Row: \(Row(value: i).value)").padding(.all, 10) | |
} | |
} | |
}.navigationTitle("Demo Objects") | |
} | |
} | |
} | |
struct ContentView_Previews: PreviewProvider { | |
static var previews: some View { | |
ContentView() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment