@@ -24,12 +24,11 @@ struct InstaFeedScreen: View
2424 {
2525 . list( itemSize: . absolute( 100 ) , sectionInsets: NSDirectionalEdgeInsets ( top: 0 , leading: 10 , bottom: 0 , trailing: 10 ) )
2626 }
27- . frame ( height: 100 )
28- . collectionViewScrollIndicatorsEnabled ( false )
29- . collectionViewOnReachedBoundary
30- { boundary in
27+ . onReachedBoundary { boundary in
3128 print ( " Reached the \( boundary) boundary " )
3229 }
30+ . scrollIndicatorsEnabled ( horizontal: false , vertical: false )
31+ . frame ( height: 100 )
3332 }
3433
3534 var storiesSection : ASTableViewSection < Int >
@@ -57,38 +56,33 @@ struct InstaFeedScreen: View
5756 {
5857 VStack ( spacing: 0 )
5958 {
60- HStack
61- {
62- Text ( " Demo sticky header view " )
63- . padding ( EdgeInsets ( top: 4 , leading: 20 , bottom: 4 , trailing: 20 ) )
64- Spacer ( )
65- }
59+ Text ( " Section \( i) " )
60+ . padding ( EdgeInsets ( top: 4 , leading: 20 , bottom: 4 , trailing: 20 ) )
61+ . frame ( maxWidth: . infinity, alignment: . leading)
6662 Divider ( )
6763 }
6864 . background ( Color ( . secondarySystemBackground) )
6965 }
7066 }
7167 }
7268
73- var sections : [ ASTableViewSection < Int > ]
74- {
75- [ storiesSection] + postSections
76- }
77-
7869 var body : some View
7970 {
80- ASTableView ( sections: sections)
81- . tableViewSeparatorsEnabled ( false )
82- . onPullToRefresh { endRefreshing in
83- print ( " PULL TO REFRESH " )
84- Timer . scheduledTimer ( withTimeInterval: 2 , repeats: false ) { _ in
85- endRefreshing ( )
86- }
87- }
88- . tableViewOnReachedBottom
71+ ASTableView {
72+ storiesSection // An ASSection
73+ postSections // An array of ASSection's
74+ }
75+ . onReachedBottom
8976 {
9077 self . loadMoreContent ( ) // REACHED BOTTOM, LOADING MORE CONTENT
9178 }
79+ . separatorsEnabled ( false )
80+ . onPullToRefresh { endRefreshing in
81+ print ( " PULL TO REFRESH " )
82+ Timer . scheduledTimer ( withTimeInterval: 2 , repeats: false ) { _ in
83+ endRefreshing ( )
84+ }
85+ }
9286 . navigationBarTitle ( " Insta Feed (tableview) " , displayMode: . inline)
9387 }
9488
0 commit comments