@@ -13,10 +13,7 @@ import RxFlow
13
13
14
14
final class ExploreVM : SectionedViewModel {
15
15
16
- private let _sections : BehaviorRelay < [ MagazineLayoutSection ] >
17
- var sections : Observable < [ MagazineLayoutSection ] > {
18
- return _sections. asObservable ( )
19
- }
16
+ @VMProperty ( [ ] ) var sections : Observable < [ MagazineLayoutSection ] >
20
17
21
18
let steps = PublishRelay < Step > ( )
22
19
private let bag = DisposeBag ( )
@@ -40,36 +37,38 @@ final class ExploreVM: SectionedViewModel {
40
37
41
38
let header = HeaderSectionTitleVM ( title: " Last visited " , subtitle: " Your last visited destinations " )
42
39
43
- self . _sections = BehaviorRelay ( value: [
44
- MagazineLayoutSection ( items: [
45
- RowHeadline1VM ( title: " Explore new places and meet new people " ) . configurator ( ) ,
46
- RowCaptionVM ( title: " Most popular destinations " ) . configurator ( )
47
- ] , sectionInset: UIEdgeInsets ( top: 16 , left: 32 , bottom: 16 , right: 16 ) ) ,
48
- MagazineLayoutSection ( items: [
49
- RowHorizontalCardsCollectionVM ( items: destinations,
50
- itemWidth: 136 ,
51
- itemHeight: 224 ,
52
- itemsSpacing: 8 ) . configurator ( )
53
- ] , sectionInset: UIEdgeInsets ( top: 24 , left: 0 , bottom: 24 , right: 0 ) ) ,
54
- MagazineLayoutSection ( items: [
55
- RowFlightInfoVM ( info: FlightInfo ( departureTime: " 05:00 " ,
56
- departureAirport: " Riga (RIX) " ,
57
- arrivalTime: " 20:00 " ,
58
- arrivalAirport: " Tokyo (HND) " ) ) . configurator ( ) ,
59
- RowFlightInfoVM ( info: FlightInfo ( departureTime: " 14:00 " ,
60
- departureAirport: " Riga (RIX) " ,
61
- arrivalTime: " 23:30 " ,
62
- arrivalAirport: " Bali (DPS) " ) ) . configurator ( ) ,
40
+ $sections. accept (
41
+ [
42
+ MagazineLayoutSection ( items: [
43
+ RowHeadline1VM ( title: " Explore new places and meet new people " ) . configurator ( ) ,
44
+ RowCaptionVM ( title: " Most popular destinations " ) . configurator ( )
45
+ ] , sectionInset: UIEdgeInsets ( top: 16 , left: 32 , bottom: 16 , right: 16 ) ) ,
46
+ MagazineLayoutSection ( items: [
47
+ RowHorizontalCardsCollectionVM ( items: destinations,
48
+ itemWidth: 136 ,
49
+ itemHeight: 224 ,
50
+ itemsSpacing: 8 ) . configurator ( )
51
+ ] , sectionInset: UIEdgeInsets ( top: 24 , left: 0 , bottom: 24 , right: 0 ) ) ,
52
+ MagazineLayoutSection ( items: [
53
+ RowFlightInfoVM ( info: FlightInfo ( departureTime: " 05:00 " ,
54
+ departureAirport: " Riga (RIX) " ,
55
+ arrivalTime: " 20:00 " ,
56
+ arrivalAirport: " Tokyo (HND) " ) ) . configurator ( ) ,
57
+ RowFlightInfoVM ( info: FlightInfo ( departureTime: " 14:00 " ,
58
+ departureAirport: " Riga (RIX) " ,
59
+ arrivalTime: " 23:30 " ,
60
+ arrivalAirport: " Bali (DPS) " ) ) . configurator ( ) ,
63
61
64
- RowFlightInfoVM ( info: FlightInfo ( departureTime: " 07:30 " ,
65
- departureAirport: " Riga (RIX) " ,
66
- arrivalTime: " 12:15 " ,
67
- arrivalAirport: " Cyprus (LCA) " ) ) . configurator ( )
68
- ] ,
69
- header: . init( item: header. configurator ( ) , visibilityMode: . visible( heightMode: header. heightMode) ) ,
70
- sectionInset: UIEdgeInsets ( top: 24 , left: 32 , bottom: 32 , right: 16 ) )
62
+ RowFlightInfoVM ( info: FlightInfo ( departureTime: " 07:30 " ,
63
+ departureAirport: " Riga (RIX) " ,
64
+ arrivalTime: " 12:15 " ,
65
+ arrivalAirport: " Cyprus (LCA) " ) ) . configurator ( )
66
+ ] ,
67
+ header: . init( item: header. configurator ( ) , visibilityMode: . visible( heightMode: header. heightMode) ) ,
68
+ sectionInset: UIEdgeInsets ( top: 24 , left: 32 , bottom: 32 , right: 16 ) )
71
69
72
- ] )
70
+ ]
71
+ )
73
72
74
73
destinations. forEach {
75
74
$0. steps. bind ( to: self . steps) . disposed ( by: bag)
0 commit comments