From 73226d45a29fb36527fc3cb51272ea4071aa66be Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Sat, 28 Mar 2020 19:28:26 -0400 Subject: [PATCH 01/44] Demo --- .../MVMCoreUISplitViewController.m | 64 +++++++++++++++++- .../Account.imageset/Account@1x.png | Bin 0 -> 978 bytes .../Account.imageset/Account@2x.png | Bin 0 -> 2136 bytes .../Account.imageset/Account@3x.png | Bin 0 -> 3355 bytes .../Account.imageset/Contents.json | 23 +++++++ .../Media.xcassets/Bag.imageset/Bag@1x.png | Bin 0 -> 394 bytes .../Media.xcassets/Bag.imageset/Bag@2x.png | Bin 0 -> 651 bytes .../Media.xcassets/Bag.imageset/Bag@3x.png | Bin 0 -> 897 bytes .../Media.xcassets/Bag.imageset/Contents.json | 23 +++++++ .../Home.imageset/Contents.json | 23 +++++++ .../Home.imageset/Home@1.5x.png | Bin 0 -> 450 bytes .../Media.xcassets/Home.imageset/Home@1x.png | Bin 0 -> 362 bytes .../Media.xcassets/Home.imageset/Home@3x.png | Bin 0 -> 919 bytes .../More.imageset/Contents.json | 23 +++++++ .../Media.xcassets/More.imageset/More@1x.png | Bin 0 -> 134 bytes .../Media.xcassets/More.imageset/More@2x.png | Bin 0 -> 160 bytes .../Media.xcassets/More.imageset/More@3x.png | Bin 0 -> 233 bytes .../Verizon Up.imageset/Contents.json | 23 +++++++ .../Verizon Up.imageset/Verizon Up@1x.png | Bin 0 -> 503 bytes .../Verizon Up.imageset/Verizon Up@2x.png | Bin 0 -> 915 bytes .../Verizon Up.imageset/Verizon Up@3x.png | Bin 0 -> 1409 bytes 21 files changed, 177 insertions(+), 2 deletions(-) create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Account@1x.png create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Account@2x.png create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Account@3x.png create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Contents.json create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Bag@1x.png create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Bag@2x.png create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Bag@3x.png create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Contents.json create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Contents.json create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Home@1.5x.png create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Home@1x.png create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Home@3x.png create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/More.imageset/Contents.json create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/More.imageset/More@1x.png create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/More.imageset/More@2x.png create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/More.imageset/More@3x.png create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Contents.json create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Verizon Up@1x.png create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Verizon Up@2x.png create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Verizon Up@3x.png diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index 476e7264..34dc2342 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -843,11 +843,27 @@ CGFloat const PanelAnimationDuration = 0.2; bottomProgressHeight.active = YES; self.bottomProgressBarHeightConstraint = bottomProgressHeight; + UITabBar *tabs = [[UITabBar alloc] init]; + tabs.translatesAutoresizingMaskIntoConstraints = NO; + tabs.tintColor = [UIColor mfRedColor]; + tabs.backgroundColor = [UIColor whiteColor]; + NSArray *tabList = @[[[UITabBarItem alloc] initWithTitle:nil image:[[MVMCoreUIUtility imageNamed:@"Home"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] tag:0], + [[UITabBarItem alloc] initWithTitle:nil image:[[MVMCoreUIUtility imageNamed:@"Account"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] tag:1], + [[UITabBarItem alloc] initWithTitle:nil image:[[MVMCoreUIUtility imageNamed:@"Bag"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] tag:2], + [[UITabBarItem alloc] initWithTitle:nil image:[[MVMCoreUIUtility imageNamed:@"Verizon Up"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] tag:3], + [[UITabBarItem alloc] initWithTitle:nil image:[[MVMCoreUIUtility imageNamed:@"More"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] tag:4]]; + [tabs setItems:tabList animated:NO]; + [tabs setSelectedItem:tabList[0]]; + tabs.delegate = self; + [self.view addSubview:tabs]; + [NSLayoutConstraint constraintWithItem:tabs attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0].active = YES; + [NSLayoutConstraint constraintWithItem:tabs attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0].active = YES; if (topAlertView) { - [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[topAlertView]-0-[mainView]-0-[progressView]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topAlertView, mainView, progressView)]]; + [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[topAlertView]-0-[mainView]-0-[progressView]-0-[tabs]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topAlertView, mainView, progressView, tabs)]]; } else { - [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[mainView]-0-[progressView]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(mainView, progressView)]]; + [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[mainView]-0-[progressView]-0-[tabs]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(mainView, progressView, tabs)]]; } + [[self.view.safeAreaLayoutGuide.bottomAnchor constraintEqualToAnchor:tabs.bottomAnchor] setActive:YES]; // Cover View UIView *coverView = [MVMCoreUICommonViewsUtility commonView]; @@ -864,6 +880,50 @@ CGFloat const PanelAnimationDuration = 0.2; [self setupPanels]; } +- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item { + switch (item.tag) { + case 0:{ + MVMCoreRequestParameters *params = [[MVMCoreRequestParameters alloc] initWithPageType:@"myFeed" extraParameters:nil]; + params.loadStyle = MFLoadStyleBecomeRoot; + params.shouldNotAnimatePush = YES; + [[MVMCoreLoadHandler sharedGlobal] loadRequest:params dataForPage:nil delegateObject:nil]; + } + break; + case 1:{ + MVMCoreRequestParameters *params = [[MVMCoreRequestParameters alloc] initWithPageType:@"accountLanding" extraParameters:nil]; + params.loadStyle = MFLoadStyleBecomeRoot; + params.shouldNotAnimatePush = YES; + [[MVMCoreLoadHandler sharedGlobal] loadRequest:params dataForPage:nil delegateObject:nil]; + } + break; + case 2:{ + MVMCoreRequestParameters *params = [[MVMCoreRequestParameters alloc] initWithPageType:@"shopHomePage" extraParameters:nil]; + params.loadStyle = MFLoadStyleBecomeRoot; + params.shouldNotAnimatePush = YES; + [[MVMCoreLoadHandler sharedGlobal] loadRequest:params dataForPage:nil delegateObject:nil]; + } + break; + case 3:{ + MVMCoreRequestParameters *params = [[MVMCoreRequestParameters alloc] initWithPageType:@"loyaltyEligibiltySelector" extraParameters:nil]; + params.loadStyle = MFLoadStyleBecomeRoot; + params.shouldNotAnimatePush = YES; + [[MVMCoreLoadHandler sharedGlobal] loadRequest:params dataForPage:nil delegateObject:nil]; + } + break; + case 4:{ + UIAlertController *controller = [UIAlertController alertControllerWithTitle:@"More" message:nil preferredStyle:UIAlertControllerStyleActionSheet]; + [controller addAction:[UIAlertAction actionWithTitle:@"Bill" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + [[MVMCoreLoadHandler sharedGlobal] loadRequest:[[MVMCoreRequestParameters alloc] initWithPageType:@"billOverview" extraParameters:nil] dataForPage:nil delegateObject:nil]; + }]]; + [controller addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]]; + [[MVMCoreNavigationHandler sharedNavigationHandler] presentViewController:controller animated:YES]; + } + break; + default: + break; + } +} + - (void)viewDidLoad { [super viewDidLoad]; [self.topAlertView pinATopViewController:self]; diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Account@1x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Account@1x.png new file mode 100644 index 0000000000000000000000000000000000000000..a77098c25cd82181cce01d235dd115837baf73bf GIT binary patch literal 978 zcmV;@11Px&j7da6R7efAmRYDxQ5eTv(@jZai0c8@REFG)g%px9L@6G;;FiLJ+Fga z+0=@#aWD%;Ko6*b-|#%*8tq}Y0>9v&)Q-_>;1!r8;KbVMi)_L70^16xgul{UMm+^5 z{07HhF;qia2r@xGSPCcMJ2>VE%!JHpN#sUwuurxNOqNvx2|NH{{JJayO}alC^qO{3 zmO%+IGq5*+H?SiireF?F`T$Gcg0;NU4bwE33SG+G1%9ft1%nD8!ag>CQohY$~OOu(@nDN0_ z(hlMJC)8nqw9Sx1(6^M*S#m!KEan0Pj*L-{85w`*i| zWs($pAvP|~BUQ~Z@$g(XU#(HMthpIk#*}#)4Z#;;8$FG^(@{6Kf>xzVReTIKhUR;H zXug2k!hWgTub<%~bT4%lU3aE$9bDJu775Gbb&^)&aFDUJ;Jd1ZCGZyXErm4s0M88a zDY7KC`ZvK3FiA1)i1knbX)^Is1MkBCaH*X%O`{3$l=D5gJ#N4*xD9FQNPw$z&A_wZ z-TT+}zhxnt>yTBQ%T7B5vdA%2U=@#o?vQ1P2`l8t;f*WY(r3E+RUxe=yn0QMwaZOxnxpLVZbP#GFtE}EoNG@;c zla@|A4MTX>-hfrQ5{7|CUr;AHo=B_UJQyn$QsO(s*R1@WS_X9xCJe2AgB~2=I<(%b zTc+8ftRNt(T<+Q6(^Y}{++@!qJO&SgpE#-d1I(!R literal 0 HcmV?d00001 diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Account@2x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Account@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..78ddbb80d0f55c0977cf64f680ef81a3c28a5549 GIT binary patch literal 2136 zcmV-e2&eanP)Px-5=lfsRA>d&n0csGRTPJ{)D)+ja!6B3d}?C#D5uh>#Hc`;{t$}{lLRA(P$Gv6 z|4~Cq(}>cX(4w#`6EP(#v~r-*(!?+`F{jEjOLNHjez&_Ht97Sy&OPs`3%z>-Rs!tl>x<6DxMV8i-jkBDkJeFlY<&G?yC_jV0;JlZ1L^v8gh12j)LQY_} z21Y@1IPYX25v_#3A?YLw*`37a66g)*Tm})rdMFgE?LURyF4zL=K&#+u_z}*4)h$$C zjb0z9ap}N_y6c4kQ~$Rx3+{t1PzMT0JuY;Ip)ebCV+#4!-j_}bs1doFQFPek3+Mp- zQ$WF&E7#-TMfeT!jdhTI9g5W|;w3nz6sC}(w1g8oCZ3z{kYmDBOrBYfX6o= z-+(jeZ>X6F=z{^j%bj-@MECxpJMB6OggJg!%&Tlh%GuBs!qHvyq8B{b$sJ z;%S%%AAp|5Yw#p=hNLnHLm%g`xX$$I@u#t#Y!Vra(Kq0O@@*~A0Z9hHX0h|H6TNR# zUmZ~N?^*5HxO+nf$TIK~E7hKhjS`VKQXl1wV155YJJKQMGbo+LkqprbqC-V?HUL}q ztH)kbU1?_{h$HP#)+DX3>7^VDat3;_$9?taFv)j()M26j*-3S*&IVxXJ!g0qv4$04pP#lVjLb|D7?oubmk zxEYl8zy8bG0f*C$D$k&3ZGWa6cRO{(=Ctvn?b97{WFQ}l)iNB zI8AG-1FdBo zk7Jo&l> zwEy@1EMcGTvL0gaxlRhdnvTutC{xB`9|j1e^5kNHU&{4GdF&phuUz>B2O*Bkmdm*V zWsaa_sV^E~kWlJSn+V$5%7m1KX}>DTu{S;F&!;~P*^QInGqZw~$%KwgX^emmJ+aS? z-{3!Lxg1+19BIgYoP=?e!PU|`E_CcsM@piA=R)uurPRA~D(LNzhRDwu2xEUGr$3mE zlj=xW`r>a5oP{v3FBQ~#&;!yG9in!uwRPy&2c1At51K*J7rlIV(bB#Zv~TZ%ifmms zKx1!%6`*~bw&+unm3^A<4(Mlk+fh$*!ojun(wxw!p;B|PvO{ZJ6Si`bZCv1WKbOp0 zwcPAFf9C?9qz&JHy6vK`g7ra5SfxbYvRZ%+lC-2fj&vY(geK4ww1{#01s#p()hF+2cC{sUuHB}1v%u@+Wc zp`!1__TtO-VvPE2=xR%7by$B%>PmUw=GKO5xpULj9gUlEo#JL^MrEz_ki3AD`afPQcz+zAiC zWKcS(v&7qnwz9BSp%Ijlw@?UnDyQc&(9*F=f6~^33W)+g0M;hdbw{Uye1=1VYDrOE za5KyT9cICwEqBu22MS47F6ib2o72=g7E;#I35qITDxmlj{b!x7^!LDU2q!+(#L^hc zC&1?VA+}TW4=dnVDQeJDIj?|TrdxN;Pekcp5Irs3ed|zl?f(hT0MZuy^V0URPc4i; z&J8w_cDSbU1YGHKa+0RM(T;?E3W}B5$q!C~Kd1$F{wJ>rJ4h zr7Z(~2R0U8R|cmi9!o}`?Hz^o7hKccI#;3;@p}mI*iw64ue(Gt11sxH^&_A^*5_LE z`pLHn$CMM8KFDeR`bn>&?}~C9muY)7_FKWnwV+JD8FTGZeUb3a57T#VMx$nb9%Z=W z;N#I`^~EL?(ffBA_(9a351pX8MNicy6&hcAwyb4bEbw7m)E^5!aiwo_p);f{`Xiux z-6uqfL8o!z0}9(n(ig3K34j97-@@17erO6wr4@z`!ZOG=QH`bdZ0uJLHi<<0dOB!= z{%MD{p88rC3j?7Cw1nCaL|a8Ceowd^Cc#E1G)ehZx;POcCl%tJJ?Gt)`A}-bn)@8Uk;^AxJuDt$>9v z7;?T;(3e>3eoE}5fT4VA-&R6J7A61svmvw%{(xh!4|E8LO`u%4TI65a>d;WKYt$S7 O0000Px>)k#D_RCodHoPV%YRTamhFn$vX1Ue#tC}L)6Xn`gOo#$cC+UK5g?>^^V zi0{nzopaV+d#$zi*=O&y_eEQLq_)tCaL#~zW9-F!N7y08L)^a`<4*3^!8I|i<^CY7 z3ACtk6fN=J9}a2aK(1|I2<*bhbFdE9!{zY5@c#+}XzeVx1FG>wa1(y+f@i{`8Yj@Y zpFn-mMRaVEk5`CcB5Vzh8g!#2Q=#V6q{dgHYzr~n2;0M4k>?!!2_l~izXQu1IqH0U z^6HRi@!P}wN1+x+b&#$-pk8RX&=htLycg~(*GM($jlropC(9^RhM-Sc4ITwQ3){l9 z(2KnQehbcot6>)Z(p8fAWnI_;D&{OVQYZy*I>tLx4e-fQ`)e2toaYKn9w^Kd==9%4Kz9O`y_D`YK zi=+^WrG%b7$C7kE}rW+$E z=FfS!c`Kp43n>eA(%9T08BEG9{!Y0Ljq-**ZN1Fyu!xka4}R7|-^hNHvY<%Hlhw&t zw#r!o(>DB8s6|Sn>ky0@eSmvyD(c`3us6&DrM_hO4g&4?qQ<#b%~hdCvPP=TE6O=e zT}-`8VQ3_+P5W@BGnR@V2fhqL3t#9tS-ZxhDaw7(zUODK^Jy3oN!eBdjyhH1>{%*X zjZq30I=lE0HV=CISuvE7?ZMUv7!p@u%;#4phGk(4wR}cH=E?fqaCU+(UkqvFn$su2 zkeG!r%eMxJMtvseRBa2i49?4BskE|2g5@VJ+mB8?ybn%>x5M8-&B^fvGF~Ts|9$jA zp*4nl)7wjwWy*%8Qz0H`biW;W7Z?f?F%;RhuG)o-he`9FvVxnTekHMNNTwI{B^V0I zhLrVK{;o;uq#KHRJw_&^HIhQ_Y;@ECRT39;+Je%xkin89g+PTTE4~^`iF`1#(n8r$n)eO z_^|?%OgVI=xB~;0eZ9nV%k{sy8XC9b~U2UfC|WkIwTKh+v=hxg6^&` z!1L!lHmn#ts;R{~Wcr(--49tSb#z~&P$C`q<$+~}QDq#%4SA)a%RL6H7(A+(#8#iF zk57}8TcA7K^{k`7JRql*KV=>vQ#{ShZyUZeKWn(vf?Z!0LX}`pMiaFox;`cA+l_+9RFE^YJ}7`F z827rDvZ=5WEQKB@%!UV{YbSc1PFWGqJRSLru8nD*j`JcxbbYXhi148Ut5t^oC=Olq zDLw+Ph67+vcq-I9{9PC=Zt*(qy>vbXi@?h`as4-@lkXb^c^ta<8rg>e>vMC1E%#ZC zO!HOv;>#*mn(D^7M4zulj0>%vMM1xKoDVe;LPH1t7r~vO4JX*M`tDs{N4HBbltzLet@G@Cvx6QezqGTYc9!nE!zxcc?GUXgs8Pe~c|KVsc}&o)1xP4(tu9 z1uMN%OpX6f3pZ%xq1A>y`5CYQy79TsI&_}`&w|y2cA{=-W` z@3>x`_s?ToydLU=QKR%kcoIASwSc|}l}_colf^|UC>ye{ULC#KDnZrV}(`^Sber1#Re&B$D};doy4u9 zOz9tk-2<%BFO-G_f#aCc>!B--0XQ3aB+l8@lB|yvs~Ot#mHX#`cRU=iJnT! zke3t8In+}&5D%c#y++%g;3W7}*c&Ph^+9vJGLuno3VaH_2TS>hm)D`+17?M$plvX2 zE4m+?WUMuXTRauVBvo|E^iuR`rky4OPxL*>Z^>m$9Mk#dTH9J zMg2b>o0lOk2~FU>QSh@8wLe9CxkB+8=Bs@Z)Rexzx zCAaKmj}h&-w7Icx9>O=F;FbM64Xu7rrqioQFY{%N$EX~QhWfOWF<6czThXM$ zrKX{2&o@fdju&A&csum9^%ly?MptV3w#r&@*Fc}+g_LPGc%+~Yfv$(X_9$!7#>pyQ zj66-If|?(LC^`Tw2R@lTueN@ZHCxi1$n+KZ+GWXiqF?ru;r7I&49;IdSD)FD3QdRq zf>x(mvJoL0szu<*6wVva=@!y)m24@6-3_gdjmxIx5uZls3niRiormKp*_>LUtx6Ph z)Q}65L#~4Hw;I3K*~T@wcrMPUzTP`wyj|}7UnsA5@hjD&Q&8AgB9Pxu-lmkH8Z1|q zH6OYi8-G@+r(=pjpao+kj0fP}YrB16A<=|!awTTALbo09XN}~-Iyq{Vwy?^TsW~TA=uLp_i|@IL(g)$}VzS z_}svfo^POVA9P27`}{gO*TD|3T2T5q8S3S`@ww01j0DY-u~#uJz(NCbgSDP_p?5F* z3@ic~jTgb$P??bxlPg<{UN2aa=tNXAq2^{caNn~|$8LlDVaQ)vT4QezoB^}!^fZ;| zfGFrRm)E?bPMZaF&4N8BFM?WRUxVwQ4tlgpOM>!y9SVv1N;G=UhgmyIyWeYJ13Y4& z#9y124bV55)5B!5@cdGL*bJUthpOa4d}SK?2Zv)}dssN~S`4!^M8Coe zhL^x0upiXuuLS$4ta-N%*2CwavWcpp7CPE(d@BT}!M;uG#Z|jFjl>R3Jj7MMx{I0$ l-hs+a)-+KYqXV#J@ITm7{O|ioBKQCR002ovPDHLkV1nioW%vL9 literal 0 HcmV?d00001 diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Contents.json b/MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Contents.json new file mode 100644 index 00000000..dd3bd4a8 --- /dev/null +++ b/MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "Account@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "Account@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "Account@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Bag@1x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Bag@1x.png new file mode 100644 index 0000000000000000000000000000000000000000..08d4e5bd78af30805965e596b3b31151508919a5 GIT binary patch literal 394 zcmV;50d@X~P)Px$L`g(JR7eeDV89QIfYR%L_%RUwN5Y?g?1Mm@3dCfA6rir(K>QDgZvgQgBzzLc z{szP#3pW8V6A%*(G=M6<1Mw3eHpih$2q+FR7-T^S4mDVXd!U*;vC1L@d4SAkK>QFP zM3{8|s08G47Q#vymI2j(TrY~Q7FSpa0~LM*;y>sbu<+kP#Xx#c04~E(6p_mTdD{z! z&Cm=G1M<0nxB*QZ8yBWG2PpXlNx@eTdnynkr(tTbUm-_WKhTm(AlrbT1&DcpI3L6z z0Ahgh&OlrR#LuB>XF_SX%R#{d1DAn}7cdS1dNNQRS)u8Bsg*mdzQ52BD0lS>0NpaM0tkE(WETh4KH3YBHq)$07*qoM6N<$f?T?jf&c&j literal 0 HcmV?d00001 diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Bag@2x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Bag@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..640cf1ecf7561cd0a46da31ec12a4c873b227788 GIT binary patch literal 651 zcmV;60(AX}P)Px%MM*?KRA>e5SUXDtK@g7O0}H_i2wI4R;Hy&<5$r6)LbR~7(Z-+QPq48Nu@l7F zN)T)XZA6nsEG&E=7FsBZMEyn*ZgSjkx9&~i!3=!K?9A-9lW+Gfm*jGOR)^`cz&20- zo`G)xMZ_O~6JQ+}1ZrZFSoIW;8jXw72iXBSfvVXGR{8+qnoE+u2G5Xd=d{(XwuA}$ z0H6Dg@eyzdyZ}*Fk6;%t4UC2gZZRGQ?nCj^hJ9dq1-O#ba4+Cub10@}InS{Rfott< zXt529x$-W2?I@-l;?2*y5G1YbK;b7_=mLIo(#b;I7~-7sP^j|?FJm@WXU2;yn7qY! z>4I+!QnE)EOi~+Wg>=r-I+F*Cw+Vhf8;h<>5ww+f>5VS@SaWIoEtc(X1z(sZ{lFF( z?Tm}kC?!mBC1FKcQ(TlrDPf8$2`kc?;-WN42~%82SdrEg7o|~3nBq#pinOM(O>t2gr9@^GkNSUn0V0hk3FSk}|NPHI lHQobu!oRl69+k{C{sYaQea`QpFRK6m002ovPDHLkV1khQAvXX3 literal 0 HcmV?d00001 diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Bag@3x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Bag@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..f621197f200f29ac556e58dd3fe2f024f20714d3 GIT binary patch literal 897 zcmeAS@N?(olHy`uVBq!ia0vp^u0R~c!3HGX@y<>MQjEnx?oJHr&dI!FU|_cPba4!+ zV0=6K>}uackz?m4x~Ls;=!kCn!T!WJ$w5-GYv)Q%i_-C^S=?<|G!!Nmie~#Z=ChU*vvk!-Aj2dRb@^M zQM1dqr2TSfiT^G=+i7ZMeJekyUs^v)wEEaRVbSQ&x6CW^Bwp4{R4(eRl?iN>U;2e* zmQ`QO#NwRCJG6dlnzAb7-#;O_GrO}+clV#0DeZN4CQf_$=BM93-b{s~zMuDos6A@i z6L?G8)qTxGjeRHYsNY?FP;bvwuU}D%w10a3i_B~dF-__>4tnFcb5YxhRGmkYRxMDP zf4aZ_@vh|AW;JSo=T$xp`D{>t-rZ}$tr`J_~W9dgHw>xicb)7J6NePkmIUNguJGAcp!R%X$=7dDAv|8n)IW^^ynj}|@p|hcg0>d=xqX7*J5ykS+>ZWF_ zkN0IOeC8Cy>Z|Ez(x8HMV=i=js|Gl~BVE?_RPv_C~@>>7K)%hB2Oe_bA zmNQJ*=`SxatCDBqWHz@w!Bw?YPb}j6ytmpmdwx4-y=PhDmTTRg^q%X^_`3L7#Wq|0 zt_6QCoO!tC=1u0Rvd>G8?0VyObXF{~6`9s~S`RO)WL^o=WQ&?>rz8<}tI$a7xaG3vwjXY@>&;sz!6m?O zdM-qB*Fpxy4RN Z@3qrEOP=WM+zQN744$rjF6*2UngGETmxKTS literal 0 HcmV?d00001 diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Contents.json b/MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Contents.json new file mode 100644 index 00000000..ef86d034 --- /dev/null +++ b/MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "Bag@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "Bag@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "Bag@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Contents.json b/MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Contents.json new file mode 100644 index 00000000..02784f80 --- /dev/null +++ b/MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "Home@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "Home@1.5x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "Home@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Home@1.5x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Home@1.5x.png new file mode 100644 index 0000000000000000000000000000000000000000..17dc8d9655ead06d4698b1ad0cd9c529c27296ae GIT binary patch literal 450 zcmV;z0X_bSP)Px$d`Uz>RA>e5m_2U7KoEru0;QoxzC{i|>h$U9attm)0d2Z;Kt+`tAe?|AH%O46 zgZEG@tyW&!S-j&}v?D$FZ|&J{W>(s9mW8(oTx_6GcvoRP5abs+LmyDIKqd%bq6I1g zi4y1uStv@207q#3mze_S6W8iX&dvxyo}nJJfC?BMRj(lz2=5ThdbO0<0duPCSj#}T*k2UF z{9sPbj&*>C56~1UY>$&2L>P_6@_L2dp`kIsoG@GCMl7cUTG^BB+c#pqPB2=tmok$w zBM^a9W&%O>a*;CQ6*hsFQf35#?Byb5#w%Px$BuPX;R9Fe^l{*RoK@5g{T|n>*9>mH*Y-|*4+g1sm3 z^#^t&#&Otn9$IYRXXlmVBQs=+IXf%BeFjyatzD?^y$NCg-Ju&4LBWkf5XetpIK%}I z9cU67Mnbd!pez`S2_hIw5(w`wX&}78d;{Se#s8b%7 literal 0 HcmV?d00001 diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Home@3x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Home@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..8d67c8010748b995eba018bbf483971e888bdda9 GIT binary patch literal 919 zcmeAS@N?(olHy`uVBq!ia0vp^X+Rvs!3HF~(v`OWDaPU;cPEB*=VV?oFfa#tx;TbZ zFuuKQndENg4Tb)Tzy`fr+Me1EZ`?|5hIG3)5`(ilJ4@P``mIe)i)Jv^;I zr)8=9ZVf)=IZIvF)Qfi&h_y*N37&JZkQ8}1p-=!w6f9f7k)Ae(=T!b|MTK2uf3;#I zG@C!&th%@TtCvOV<@c7cVo&c~{kT0x+|Pf;(s^!yi`Ew?bxM9)sbSa!WHkL=2w^Z) zYfh1HwU~H>u{smNXsOi$Ggvm9?-g3ip+3pujSfWSz&W?hz!qW8k~iK9k7yj~R4Mzm zG%!izp^MPA^{lFHLg%;wTQ(<6Syp)M+b27op9pwalS`y4yOd{i+JB%^M9H4 z{+m~SmplEI+iS7gAaV-(wWrzf>bC#mnf{4>Z{L>gRK&=R0MK(jORn|MA2?pRMc5;!T_u=PsYo zd~B;0yjm)WsY$V|cZ(3uB(aTQ21hnb3~O?{q;!p|O~UMwmw`vrk*I?Lhuxw$**v== zv?Y>mcxWF~$P~@-IRFzQCOe#QjEnx?oJHr&dIz4avVHe978Mw zlT#8BHn1nHVsu;J`F~}a)CC2#EGe_BYYM!L2j}NF=q<_elU!nGxMU7%*Ob3kN(`@F hRy=W_Dr=VjgX|QRqkFbYyaF_f!PC{xWt~$(6982hD)ayV literal 0 HcmV?d00001 diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/More.imageset/More@2x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/More.imageset/More@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..158c6636bd8a70a0116d6999a66312cd0dcd1a59 GIT binary patch literal 160 zcmeAS@N?(olHy`uVBq!ia0vp^8bGYV!3HFM+f;}FDaPU;cPEB*=VV?2IZ>W2jv*18 zZ>JsPWKiHavZ~v9*DXmtMUOw?Nm?_sen?KwpC~C^Fqu(Za@|dqCHWq9ycrJ6Qa|oC zm`={SG0T(p(PaC*3qDI-Xkat>aD(BWy5aUq;t6?6**<<|zh2BTdFQN2{Xkn7JYD@< J);T3K0RT%MHdX)t literal 0 HcmV?d00001 diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/More.imageset/More@3x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/More.imageset/More@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..54de11dc7af5b0cdc2287bbebebe1812b8d65e3e GIT binary patch literal 233 zcmeAS@N?(olHy`uVBq!ia0vp^Hb88~!3HE}r~eWGQjEnx?oJHr&dIz4au$2KIEG}f zzP(|{)nFjN;vo9}>E)VP|9pHkmvNMB@0sh)^iC(@j!ESv)@SPXCdz)CyN-3=y~S^~ zt6JYPpL-yF@|w=J&A+C!F)%W*a0n9hZ)frbi`uSuxacTvec5mC_lK9uu2C;w{>;ys UTrk_X9OzsIPgg&ebxsLQ0O+GqjQ{`u literal 0 HcmV?d00001 diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Contents.json b/MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Contents.json new file mode 100644 index 00000000..11c37b59 --- /dev/null +++ b/MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "Verizon Up@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "Verizon Up@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "Verizon Up@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Verizon Up@1x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Verizon Up@1x.png new file mode 100644 index 0000000000000000000000000000000000000000..aa034686f4d37e854d6c3fa1074d2e00a6f2c840 GIT binary patch literal 503 zcmVPx$u}MThR7ef&RnIF0Q5c;O3s#iaDN9O;va`0dRF?svT!e)j2$n2klM=tgx0eruTBVn2_n}s&qa9$Vugo)#B z3VD|NNaSX{| zeLLHCg>Rt9@%LW^y%HS^1#G8$G7MPcq7=mDwtk9Ipva_&osCD%xKEVO;OPl)dy@UZ zOYoKCf|@;do~vrwPO1^D>)xHc|L(o-b86q&-Yz^B_qD$I?fJd6;DtARo*Pckepl?!l{>R1oFf9J6@I)?b$69HxMfGTarw=)}xGrf{JB=tO%<|ZEDv7Ww6rESK;Nh+7nq-L-)__?1g2)I18O6KX>RVJsG zPFc;nuK(9ewe3@jqJqPZW=^TQz`L!XGC`(-Igdf|xnYL)mE-%TWb!eT)Gs~1{Y--X zoK35P-tRx26wg?G^w8>W_cy*}vom_apy1tB%l7%Jt!uNSu2k=lGLagF^v3NXZx>$G zim=_`9MU!?_~o&%s*6n1cGj`}KIpYU@DBSjpSBxmlQLgb#$EbqBD~?pn%3P*KTf~! zp5e3QM&@@jo=x{UYkc_Af{&t{A^c&t>e<{~43~8OQfc;H^Gvef(F3veY%#wTa_shZ z4_d!m#QNu!VerlNT&3zQ)1OFwC|E!9PpRDFjK`1mTl|?@vYbgSTQYG~tM{TbOPQGI z@2uPRPd+EK!N$cWGDBb!!)qQr-_UIf1I3Q>ioFxQQ_OvT(kY=2+}{1aA6#QT`O2t3 zw!+>q)0lM*`!Cf!ZNJJAPWg7sSDP7feiOg_!r)^6ISl2BnH#2j%li}7$ey4ygFC0w zlJmXpw!TSLmOak1Y{TNdY(7;Xb!zrBoi(|A(;uoHzL)e`XXWH}i#Z+zRsFT;P5ozU z1TTH-xlsE)=;j(>yQ*moOaI3v2v0arGVx42EB68A3+V^8&VTgH{oTiM&Iy;MICd~6 zSpLY6x_oW(ox`i%7i%z82ApNQe;{~4Q`UlV#`u>@4=Nc5pJDqHYQpeD`4M}D_btu{ z-aGwDFSeYR_IU4G6+G_*tX=uyzfnTv zWG=mra(w%qG_vzQ mU;XW_>$!D~UYILe9kWG6tN(e^MljKR~@&t;ucLK6T`ajHcC literal 0 HcmV?d00001 diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Verizon Up@3x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Verizon Up@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..072a2758e8af7fcc5a3a6e1c6ab408b6c8de84b3 GIT binary patch literal 1409 zcmV-{1%CR8P)Px)J4r-ARCodHolR^OMHt6hf*?vL6cddCDRRKZ)Sd`xOf<+>f(5T$2*zGe(gQcI zUJWFCc+qH6YmA98UKGMd_(-Zk(uUTQkaB=G1&kW2CQ39amH$6slV$eZnP+!qr|tHc z?BIGy5*IwWX!ye@Iic1jZIr8(*U*1Qc{aqT-{1t{89cGu$iNli3kig;W?^PhlriOlY;hVD2kw zQ3M4o!sPFyp#2$&A}DAPCVwXd?axpYK|zZ!`8z3Se}~F! zP72zep(uia7Gd&tQqcYkMG+LV2$R2)g7#-9ilCrHnEag-v_C^p1O+X^<2^vgf%klzDshE_w5 zKtDl~&~fNfr~y@;%$H}FFY^LTvp7lFw~njW0DI!w>}d99(BeOFudRo0JPJ))eA(6= z=n(WU6e7*57iii+>^tZ!sMSG_(`O$v0zKyNEp4vj9L-02=4rGh{OX>*Pm&)r1@Pcm;vwp}`hZ(!dyldV~+Wr$K{m=#IUx?F5 zFXWnw_roW>azWNF%~jA`Ex6LpaM%uAN;!Ux^Y@{X&{L^$^Rx#Aycs{5hO+s(P93}v zTc9-LgwYM0Y=$_(^AZOjeS)RBg62l#dkZCQfWENUX|ipg996UCx`O^7d#Ra{PckL< z7j)mB^~=>2^c4Y?YYrc7)q|zFf}Ru*`oZB7bmLM-(EkA7-wud0bLl5py$C|NU1kgD zMeeSOJs8WiPG&IfAZ_dM-{=%7#RAPIX}0vF%~-;=R#0b+!{=9ry^uK;=nhA(_?R?g zdPNZIC5O*thrN(FBxpWx&r5AEyqsfPh4S7UTiIeh9$jv!yco897CTLR%o;3(1U=>G z6(7Qz+g?5`<92w7qpoST&8_rZ263Idlo=!Onh!#c8s+IMza-D53w+NP`UXhV=T6Kv z?-BASGy+XRoe)8n>4RjoumiFA%g)=-5X3sqL2p7kAzL~HW5ec9)K=yq^V&EEgKKW& zNA~%9!lClig%-Xl(aPZxb*xoFP8|biNwR*mc4!tDzeFFt4&9HCpnpN<-Ywa|^QgyP zrlrX>NB|DNH!#BcIX}GM8Teo!~a$2uLAX4bM$V+a&58A<{Bt?5h`-S z%^11)(4hZAOFhsLi07{KF&sE&^SzId={kb(=csdnpuA}xL0rqTUL`5ymtoRDK2Yz2 z-h()@wn80HJH%}*p9OQO7=X9}NzxlQS(0RoBR|sVAvuM-u(|W)41pv zSs8_%qeG2~+Qm`Ok#4DiR?v|ML~2GybR^JKtfOOey&sKyV`=E7#Wo|RxeEFWXi;+} z>C_SFRw-x&9f?4sW^_a==tu-2HKQY1K}RAGsTm#73OW*jNX_VoR?v|ML~2Gyw1SRA zAW}0rq7`%`0+E{05v`yj5s1``j%WoPi9n=g__8414Kvde3L0ji=0yZL;bs1Fzp=a@ zXZiQ|n*L2bQB&%aA)s?~21zvq3c4DunWzdngQS`Q&e3Dlgx07j0uy%u1W?Mr7#WG% P00000NkvXXu0mjf61$WO literal 0 HcmV?d00001 From 614c166e8e4063059acd7ec97a0bac02762adef6 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Wed, 13 May 2020 18:04:34 +0530 Subject: [PATCH 02/44] 18931(iOS - List - Left Variable - Radio Button - All Text & Links) initial commit --- MVMCoreUI.xcodeproj/project.pbxproj | 8 ++ MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 + ...ftVariableRadioButtonAllTextAndLinks.swift | 90 +++++++++++++++++++ ...iableRadioButtonAllTextAndLinksModel.swift | 55 ++++++++++++ 4 files changed, 154 insertions(+) create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinks.swift create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinksModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 1b66b097..a7d24dff 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -195,6 +195,8 @@ AA617AB22453012400910B8F /* ListDeviceComplexLinkSmallModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA617AB12453012400910B8F /* ListDeviceComplexLinkSmallModel.swift */; }; AA69AAF62445BF5700AF3D3B /* ListLeftVariableCheckboxBodyText.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA69AAF52445BF5700AF3D3B /* ListLeftVariableCheckboxBodyText.swift */; }; AA69AAF82445BF6800AF3D3B /* ListLeftVariableCheckboxBodyTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA69AAF72445BF6800AF3D3B /* ListLeftVariableCheckboxBodyTextModel.swift */; }; + AA7F32AB246C0F7900C965BA /* ListLeftVariableRadioButtonAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA7F32AA246C0F7900C965BA /* ListLeftVariableRadioButtonAllTextAndLinksModel.swift */; }; + AA7F32AD246C0F8C00C965BA /* ListLeftVariableRadioButtonAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA7F32AC246C0F8C00C965BA /* ListLeftVariableRadioButtonAllTextAndLinks.swift */; }; AA85236C244435A20059CC1E /* RadioSwatchCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA85236B244435A20059CC1E /* RadioSwatchCollectionViewCell.swift */; }; AAA74A172410C04600080241 /* HeadersH2NoButtonsBodyText.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAA74A162410C04600080241 /* HeadersH2NoButtonsBodyText.swift */; }; AAA74A192410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAA74A182410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift */; }; @@ -608,6 +610,8 @@ AA617AB12453012400910B8F /* ListDeviceComplexLinkSmallModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexLinkSmallModel.swift; sourceTree = ""; }; AA69AAF52445BF5700AF3D3B /* ListLeftVariableCheckboxBodyText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxBodyText.swift; sourceTree = ""; }; AA69AAF72445BF6800AF3D3B /* ListLeftVariableCheckboxBodyTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxBodyTextModel.swift; sourceTree = ""; }; + AA7F32AA246C0F7900C965BA /* ListLeftVariableRadioButtonAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonAllTextAndLinksModel.swift; sourceTree = ""; }; + AA7F32AC246C0F8C00C965BA /* ListLeftVariableRadioButtonAllTextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonAllTextAndLinks.swift; sourceTree = ""; }; AA85236B244435A20059CC1E /* RadioSwatchCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatchCollectionViewCell.swift; sourceTree = ""; }; AAA74A162410C04600080241 /* HeadersH2NoButtonsBodyText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2NoButtonsBodyText.swift; sourceTree = ""; }; AAA74A182410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2NoButtonsBodyTextModel.swift; sourceTree = ""; }; @@ -1263,6 +1267,8 @@ 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */, 0A6682A32434DB8D00AD3CA1 /* ListLeftVariableRadioButtonBodyTextModel.swift */, 0A6682A12434DB4F00AD3CA1 /* ListLeftVariableRadioButtonBodyText.swift */, + AA7F32AA246C0F7900C965BA /* ListLeftVariableRadioButtonAllTextAndLinksModel.swift */, + AA7F32AC246C0F8C00C965BA /* ListLeftVariableRadioButtonAllTextAndLinks.swift */, ); path = LeftVariable; sourceTree = ""; @@ -1952,6 +1958,7 @@ D21B7F602437C5BC00051ABF /* MoleculeStackView.swift in Sources */, 0A6682A42434DB8D00AD3CA1 /* ListLeftVariableRadioButtonBodyTextModel.swift in Sources */, AA2AD116244EE46800BBFFE3 /* ListDeviceComplexLinkMedium.swift in Sources */, + AA7F32AD246C0F8C00C965BA /* ListLeftVariableRadioButtonAllTextAndLinks.swift in Sources */, 0A9D09202433796500D2E6C0 /* BarsIndicatorView.swift in Sources */, D2E2A99423D8CCBC000B42E6 /* HeadlineBodyLinkModel.swift in Sources */, 01004F3022721C3800991ECC /* RadioButton.swift in Sources */, @@ -2158,6 +2165,7 @@ D2A638FD22CA98280052ED1F /* HeadlineBody.swift in Sources */, AAA74A172410C04600080241 /* HeadersH2NoButtonsBodyText.swift in Sources */, 522679C223FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinksModel.swift in Sources */, + AA7F32AB246C0F7900C965BA /* ListLeftVariableRadioButtonAllTextAndLinksModel.swift in Sources */, 8D084AD02410BF4800951227 /* ListOneColumnFullWidthTextBodyTextModel.swift in Sources */, D253BB9E2458751F002DE544 /* BGImageMoleculeModel.swift in Sources */, 0ABD1371237DB0450081388D /* ItemDropdownEntryField.swift in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index 7f120e1d..21454336 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -162,6 +162,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnInternationalData.self, viewModelClass: ListThreeColumnInternationalDataModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnDataUsage.self, viewModelClass: ListThreeColumnDataUsageModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageListItem.self, viewModelClass: ListFourColumnDataUsageListItemModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableRadioButtonAllTextAndLinks.self, viewModelClass: ListLeftVariableRadioButtonAllTextAndLinksModel.self) // Designed Section Dividers MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinks.swift new file mode 100644 index 00000000..bdaba9c2 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinks.swift @@ -0,0 +1,90 @@ +// +// ListLeftVariableRadioButtonAllTextAndLinks.swift +// MVMCoreUI +// +// Created by Lekshmi S on 13/05/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +@objcMembers open class ListLeftVariableRadioButtonAllTextAndLinks: TableViewCell { + //----------------------------------------------------- + // MARK: - Outlets + //----------------------------------------------------- + let radioButton = RadioButton() + let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink() + var stack: Stack + + private var observation: NSKeyValueObservation? = nil + + //----------------------------------------------------- + // MARK: - Initializers + //----------------------------------------------------- + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: radioButton, model: StackItemModel(horizontalAlignment: .fill)), + (view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading))], + axis: .horizontal) + super.init(style: style, reuseIdentifier: reuseIdentifier) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + //----------------------------------------------------- + // MARK: - View Lifecycle + //----------------------------------------------------- + override open func setupView() { + super.setupView() + addMolecule(stack) + stack.restack() + radioButton.isAccessibilityElement = false + isAccessibilityElement = true + updateAccessibilityLabel() + accessibilityTraits = .button + accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint") + updateAccessibilityLabel() + + observation = observe(\.radioButton.isSelected, options: [.new]) { [weak self] _, _ in + self?.updateAccessibilityLabel() + } + } + + //---------------------------------------------------- + // MARK: - Molecule + //---------------------------------------------------- + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListLeftVariableRadioButtonAllTextAndLinksModel else { return} + radioButton.set(with: model.radioButton, delegateObject, additionalData) + eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData) + updateAccessibilityLabel() + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 90 + } + + public override func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { + radioButton.tapAction() + } + + func updateAccessibilityLabel() { + + var message = MVMCoreUIUtility.hardcodedString(withKey: "radio_button") ?? "" + radioButton.updateAccessibilityLabel() + if let radioButtonLabel = radioButton.accessibilityLabel { + message += radioButtonLabel + ", " + } + if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text { + message += eyebrowLabel + ", " + } + if let headlineLabel = eyebrowHeadlineBodyLink.headline.text { + message += headlineLabel + ", " + } + if let bodyLabel = eyebrowHeadlineBodyLink.body.text { + message += bodyLabel + } + accessibilityLabel = message + } +} diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinksModel.swift new file mode 100644 index 00000000..1ac8e80d --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinksModel.swift @@ -0,0 +1,55 @@ +// +// ListLeftVariableRadioButtonAllTextAndLinksModel.swift +// MVMCoreUI +// +// Created by Lekshmi S on 13/05/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +open class ListLeftVariableRadioButtonAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + open class var identifier: String { + return "listLVRBAll" + } + public var radioButton: RadioButtonModel + public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel + + //-------------------------------------------------- + // MARK: - Initializer + //-------------------------------------------------- + public init(radioButton: RadioButtonModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) { + self.radioButton = radioButton + self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink + super.init() + } + + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + private enum CodingKeys: String, CodingKey { + case moleculeName + case eyebrowHeadlineBodyLink + case radioButton + } + + //-------------------------------------------------- + // MARK: - Codec + //-------------------------------------------------- + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + radioButton = try typeContainer.decode(RadioButtonModel.self, forKey: .radioButton) + eyebrowHeadlineBodyLink = try typeContainer.decode(EyebrowHeadlineBodyLinkModel.self, forKey: .eyebrowHeadlineBodyLink) + try super.init(from: decoder) + } + + open override func encode(to encoder: Encoder) throws { + try super.encode(to: encoder) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) + try container.encode(eyebrowHeadlineBodyLink, forKey: .eyebrowHeadlineBodyLink) + try container.encode(radioButton, forKey: .radioButton) + } +} From 24d0390e2544738789c83d16f5527941243d67df Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Thu, 21 May 2020 13:03:36 +0530 Subject: [PATCH 03/44] Code clean as per review comment. --- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index dc0ddbcd..5518aca6 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -145,6 +145,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableCheckboxAllTextAndLinks.self, viewModelClass: ListLeftVariableCheckboxAllTextAndLinksModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableRadioButtonAndPaymentMethod.self, viewModelClass: ListLeftVariableRadioButtonAndPaymentMethodModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableRadioButtonBodyText.self, viewModelClass: ListLeftVariableRadioButtonBodyTextModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableRadioButtonAllTextAndLinks.self, viewModelClass: ListLeftVariableRadioButtonAllTextAndLinksModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableCheckboxBodyText.self, viewModelClass: ListLeftVariableCheckboxBodyTextModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableIconAllTextLinks.self, viewModelClass: ListLeftVariableIconAllTextLinksModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListRVWheel.self, viewModelClass: ListRVWheelModel.self) @@ -164,7 +165,6 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnDataUsage.self, viewModelClass: ListThreeColumnDataUsageModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageListItem.self, viewModelClass: ListFourColumnDataUsageListItemModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListProgressBarThin.self, viewModelClass: ListProgressBarThinModel.self) - MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableRadioButtonAllTextAndLinks.self, viewModelClass: ListLeftVariableRadioButtonAllTextAndLinksModel.self) // Designed Section Dividers MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) From 00c114bb465b07e2b9ee5c05e361cb03bcfcf2b2 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Thu, 28 May 2020 08:46:19 +0530 Subject: [PATCH 04/44] Intial commit --- MVMCoreUI.xcodeproj/project.pbxproj | 16 +++ .../CollectionViewCenterLayout.swift | 61 +++++++++ .../Selectors/TagCollectionViewCell.swift | 32 +++++ .../Atomic/Atoms/Selectors/TagsList.swift | 120 ++++++++++++++++++ .../Atoms/Selectors/TagsListModel.swift | 44 +++++++ MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 2 + 6 files changed, 275 insertions(+) create mode 100644 MVMCoreUI/Atomic/Atoms/Selectors/CollectionViewCenterLayout.swift create mode 100644 MVMCoreUI/Atomic/Atoms/Selectors/TagCollectionViewCell.swift create mode 100644 MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift create mode 100644 MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 9079fc39..76bd5c1f 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -215,6 +215,10 @@ BB2BF0EC2452A9D5001D0FC2 /* ListDeviceComplexButtonSmallModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2BF0EB2452A9D5001D0FC2 /* ListDeviceComplexButtonSmallModel.swift */; }; BB2C968F24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */; }; BB2C969224330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2C969124330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift */; }; + BB2FB3BB247E7EBC00DF73CD /* TagCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3BA247E7EBC00DF73CD /* TagCollectionViewCell.swift */; }; + BB2FB3BD247E7EF200DF73CD /* TagsList.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3BC247E7EF200DF73CD /* TagsList.swift */; }; + BB2FB3BF247E7F0900DF73CD /* TagsListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3BE247E7F0900DF73CD /* TagsListModel.swift */; }; + BB2FB3C1247EC1EB00DF73CD /* CollectionViewCenterLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3C0247EC1EB00DF73CD /* CollectionViewCenterLayout.swift */; }; BB47A586241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */; }; BB47A588241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift */; }; BB54C5202434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB54C51E2434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift */; }; @@ -641,6 +645,10 @@ BB2BF0EB2452A9D5001D0FC2 /* ListDeviceComplexButtonSmallModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonSmallModel.swift; sourceTree = ""; }; BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableTextLinkAllTextAndLinksModel.swift; sourceTree = ""; }; BB2C969124330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableTextLinkAllTextAndLinks.swift; sourceTree = ""; }; + BB2FB3BA247E7EBC00DF73CD /* TagCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagCollectionViewCell.swift; sourceTree = ""; }; + BB2FB3BC247E7EF200DF73CD /* TagsList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagsList.swift; sourceTree = ""; }; + BB2FB3BE247E7F0900DF73CD /* TagsListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagsListModel.swift; sourceTree = ""; }; + BB2FB3C0247EC1EB00DF73CD /* CollectionViewCenterLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionViewCenterLayout.swift; sourceTree = ""; }; BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsectionModel.swift; sourceTree = ""; }; BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsection.swift; sourceTree = ""; }; BB54C51E2434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableButtonAllTextAndLinks.swift; sourceTree = ""; }; @@ -1404,6 +1412,10 @@ D264FAA8243FE17A00D98315 /* Selectors */ = { isa = PBXGroup; children = ( + BB2FB3BA247E7EBC00DF73CD /* TagCollectionViewCell.swift */, + BB2FB3C0247EC1EB00DF73CD /* CollectionViewCenterLayout.swift */, + BB2FB3BC247E7EF200DF73CD /* TagsList.swift */, + BB2FB3BE247E7F0900DF73CD /* TagsListModel.swift */, D264FAAB2441009400D98315 /* RadioBoxCollectionViewCell.swift */, BBAA4F01243D8E3B005AAD5F /* RadioBoxesModel.swift */, BBAA4EFF243D8E3B005AAD5F /* RadioBoxes.swift */, @@ -2090,6 +2102,7 @@ D2755D7B23689C7500485468 /* TableViewCell.swift in Sources */, 0A25209624645AFD000FA9F6 /* TextViewEntryField.swift in Sources */, 014AA72623C501E2006F3E93 /* ContainerModelProtocol.swift in Sources */, + BB2FB3BF247E7F0900DF73CD /* TagsListModel.swift in Sources */, AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */, 011D9626240EBB16000E3791 /* RadioButtonLabelModel.swift in Sources */, 8DDD6C1D244D90B8006A2232 /* ListThreeColumnDataUsage.swift in Sources */, @@ -2155,6 +2168,7 @@ D260105D23D0BCD400764D80 /* Stack.swift in Sources */, 0A7EF85D23D8A95600B2AAD1 /* TextEntryFieldModel.swift in Sources */, BB54C5212434D92F0038326C /* ListRightVariableButtonAllTextAndLinksModel.swift in Sources */, + BB2FB3C1247EC1EB00DF73CD /* CollectionViewCenterLayout.swift in Sources */, D2092349244A51D40044AD09 /* RadioSwatchModel.swift in Sources */, 8DD1E370243B3D0500D8F2DF /* ListThreeColumnInternationalData.swift in Sources */, D2D6CD4222E78FAB00D701B8 /* ThreeLayerTemplate.swift in Sources */, @@ -2224,6 +2238,7 @@ D253BB9E2458751F002DE544 /* BGImageMoleculeModel.swift in Sources */, 0ABD1371237DB0450081388D /* ItemDropdownEntryField.swift in Sources */, 8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */, + BB2FB3BD247E7EF200DF73CD /* TagsList.swift in Sources */, BBAA4F03243D8E3B005AAD5F /* RadioBoxes.swift in Sources */, D2E1FAE12268E81D00AEFD8C /* MoleculeListTemplate.swift in Sources */, 525019E72406853600EED91C /* ListFourColumnDataUsageDivider.swift in Sources */, @@ -2267,6 +2282,7 @@ 0A21DB83235DFBC500C160A2 /* MdnEntryField.swift in Sources */, 0AE98BB723FF18E9004C5109 /* ArrowModel.swift in Sources */, D28A837D23CCA86A00DFE4FC /* TabsListItemModel.swift in Sources */, + BB2FB3BB247E7EBC00DF73CD /* TagCollectionViewCell.swift in Sources */, 012A88C6238DA34000FE3DA1 /* ModuleMoleculeModel.swift in Sources */, 94C2D9A123872BCC0006CF46 /* LabelAttributeUnderlineModel.swift in Sources */, D20A9A5E2243D3E300ADE781 /* TwoButtonView.swift in Sources */, diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/CollectionViewCenterLayout.swift b/MVMCoreUI/Atomic/Atoms/Selectors/CollectionViewCenterLayout.swift new file mode 100644 index 00000000..671629b9 --- /dev/null +++ b/MVMCoreUI/Atomic/Atoms/Selectors/CollectionViewCenterLayout.swift @@ -0,0 +1,61 @@ +// +// CollectionViewCenterLayout.swift +// MVMCoreUI +// +// Created by Dhamodaram Nandi on 27/05/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import UIKit + +class CollectionViewRow { + var attributes = [UICollectionViewLayoutAttributes]() + var spacing: CGFloat = 0 + + + + init(spacing: CGFloat) { + self.spacing = spacing + } + + func add(attribute: UICollectionViewLayoutAttributes) { + attributes.append(attribute) + } + + var rowWidth: CGFloat { + return attributes.reduce(0, { result, attribute -> CGFloat in + return result + attribute.frame.width + }) + CGFloat(attributes.count - 1) * spacing + } + + func centerLayout(collectionViewWidth: CGFloat) { + let padding = (collectionViewWidth - rowWidth) / 2 + var offset = padding + for attribute in attributes { + attribute.frame.origin.x = offset + offset += attribute.frame.width + spacing + } + } +} + +class UICollectionViewCenterLayout: UICollectionViewFlowLayout { + override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { + guard let attributes = super.layoutAttributesForElements(in: rect) else { + return nil + } + + var rows = [CollectionViewRow]() + var currentRowY: CGFloat = -1 + + for attribute in attributes { + if currentRowY != attribute.frame.origin.y { + currentRowY = attribute.frame.origin.y + rows.append(CollectionViewRow(spacing: 10)) + } + rows.last?.add(attribute: attribute) + } + + rows.forEach { $0.centerLayout(collectionViewWidth: collectionView?.frame.width ?? 0) } + return rows.flatMap { $0.attributes } + } +} diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagCollectionViewCell.swift b/MVMCoreUI/Atomic/Atoms/Selectors/TagCollectionViewCell.swift new file mode 100644 index 00000000..086530f0 --- /dev/null +++ b/MVMCoreUI/Atomic/Atoms/Selectors/TagCollectionViewCell.swift @@ -0,0 +1,32 @@ +// +// TagCollectionViewCell.swift +// MVMCoreUI +// +// Created by Dhamodaram Nandi on 27/05/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +open class TagCollectionViewCell: CollectionViewCell { + public let tagLabel = Label() + + open override func reset() { + super.reset() + backgroundColor = .clear + } + + open override func setupView() { + super.setupView() + layer.borderColor = UIColor.mvmCoolGray6.cgColor + layer.borderWidth = 1 + + tagLabel.numberOfLines = 0 + addMolecule(tagLabel) + MVMCoreUIUtility.setMarginsFor(contentView, leading: 15, top: 13, trailing: 15, bottom: 13) + } + + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + guard let model = model as? LabelModel else { return } + tagLabel.set(with: model, delegateObject, additionalData) + } +} diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift b/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift new file mode 100644 index 00000000..0f582017 --- /dev/null +++ b/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift @@ -0,0 +1,120 @@ +// +// TagsList.swift +// MVMCoreUI +// +// Created by Dhamodaram Nandi on 27/05/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +open class TagsList: View { + + public var collectionView: CollectionView! + public var collectionViewHeight: NSLayoutConstraint! + private let itemSpacing: CGFloat = 12.0 + private var tagsListModel: TagsListModel? { + return model as? TagsListModel + } + + private var delegateObject: MVMCoreUIDelegateObject? + + /// The models for the molecules. + public var tags: [LabelModel]? + + + open override func layoutSubviews() { + super.layoutSubviews() + // Accounts for any collection size changes + DispatchQueue.main.async { + self.collectionView.collectionViewLayout.invalidateLayout() + } + } + + // MARK: - MVMCoreViewProtocol + open override func setupView() { + super.setupView() + collectionView = createCollectionView() + addSubview(collectionView) + NSLayoutConstraint.constraintPinSubview(toSuperview: collectionView) + collectionViewHeight = collectionView.heightAnchor.constraint(equalToConstant: 200) + collectionViewHeight?.isActive = true + } + + // MARK: - MoleculeViewProtocol + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.set(with: model, delegateObject, additionalData) + self.delegateObject = delegateObject + + guard let tagsListModel = model as? TagsListModel else { return } + tags = tagsListModel.tags + registerCells() + setHeight() + collectionView.reloadData() + } + + @objc override open func updateView(_ size: CGFloat) { + super.updateView(size) + collectionView.updateView(size) + } + + // MARK: - Creation + + /// Creates the layout for the collection. + open func createCollectionViewLayout() -> UICollectionViewLayout { + let layout = UICollectionViewFlowLayout() + layout.scrollDirection = .vertical + layout.estimatedItemSize = CGSize(width: 140, height: 40) + layout.minimumLineSpacing = 24.0 + layout.minimumInteritemSpacing = itemSpacing + return layout + } + + /// Creates the collection view. + open func createCollectionView() -> CollectionView { + let collection = CollectionView(frame: .zero, collectionViewLayout: createCollectionViewLayout()) + collection.dataSource = self + collection.delegate = self + return collection + } + + /// Registers the cells with the collection view + open func registerCells() { + collectionView.register(TagCollectionViewCell.self, forCellWithReuseIdentifier: "TagCollectionViewCell") + } + + // MARK: - JSON Setters + open func setHeight() { + + } +} + + + +extension TagsList: UICollectionViewDataSource { + open func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return tags?.count ?? 0 + } + + open func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + guard let molecule = tags?[indexPath.row], + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "TagCollectionViewCell", for: indexPath) as? TagCollectionViewCell else { + fatalError() + } + cell.reset() + cell.set(with: molecule, delegateObject, nil) + cell.layoutIfNeeded() + return cell + } +} + +extension TagsList: UICollectionViewDelegate { + + + + open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + + } + + +} + diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift b/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift new file mode 100644 index 00000000..4784c381 --- /dev/null +++ b/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift @@ -0,0 +1,44 @@ +// +// TagsListModel.swift +// MVMCoreUI +// +// Created by Dhamodaram Nandi on 27/05/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +import Foundation +@objcMembers public class TagsListModel: MoleculeModelProtocol { + + public var backgroundColor: Color? + public static var identifier: String = "tagsList" + public var tags: [LabelModel] + public var borderColor: Color? + + private enum CodingKeys: String, CodingKey { + case moleculeName + case borderColor + case backgroundColor + case tags + + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + borderColor = try typeContainer.decodeIfPresent(Color.self, forKey: .borderColor) + tags = try typeContainer.decode([LabelModel].self, forKey: .tags) + backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) + + + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) + try container.encode(tags, forKey: .tags) + try container.encodeIfPresent(borderColor, forKey: .borderColor) + try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) + + + } +} diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index 18b3fee7..6384ea3c 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -73,6 +73,8 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: RadioBoxes.self, viewModelClass: RadioBoxesModel.self) MoleculeObjectMapping.shared()?.register(viewClass: Checkbox.self, viewModelClass: CheckboxModel.self) MoleculeObjectMapping.shared()?.register(viewClass: RadioSwatches.self, viewModelClass: RadioSwatchesModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: TagsList.self, viewModelClass: TagsListModel.self) + // Other Atoms MoleculeObjectMapping.shared()?.register(viewClass: ProgressBar.self, viewModelClass: ProgressBarModel.self) From 6068d5b1c524e5bf8b283aa6070a30000b6c6a4f Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 28 May 2020 20:42:02 -0400 Subject: [PATCH 05/44] changes after discuss with Ryan --- .../Atomic/Atoms/Selectors/RadioButton.swift | 6 +-- ...ftVariableRadioButtonAllTextAndLinks.swift | 40 ++++++++++++++----- ...tVariableRadioButtonAndPaymentMethod.swift | 40 ++++++++++++------- .../ListLeftVariableRadioButtonBodyText.swift | 9 +++-- 4 files changed, 64 insertions(+), 31 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/RadioButton.swift b/MVMCoreUI/Atomic/Atoms/Selectors/RadioButton.swift index 1ac28ded..43750513 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/RadioButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/RadioButton.swift @@ -125,9 +125,9 @@ import UIKit /// Adjust accessibility label based on state of RadioButton. func updateAccessibilityLabel() { - - if let state = MVMCoreUIUtility.hardcodedString(withKey: isSelected ? "radio_selected_state" : "radio_not_selected_state") { - accessibilityLabel = state + if let message = MVMCoreUIUtility.hardcodedString(withKey: "radio_button"), + let selectedState = MVMCoreUIUtility.hardcodedString(withKey: isSelected ? "radio_selected_state" : "radio_not_selected_state") { + accessibilityLabel = message + selectedState } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinks.swift index bdaba9c2..fd71bd6d 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinks.swift @@ -22,8 +22,8 @@ import Foundation //----------------------------------------------------- public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { stack = Stack.createStack(with: [(view: radioButton, model: StackItemModel(horizontalAlignment: .fill)), - (view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading))], - axis: .horizontal) + (view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading))], + axis: .horizontal) super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -38,13 +38,11 @@ import Foundation super.setupView() addMolecule(stack) stack.restack() - radioButton.isAccessibilityElement = false - isAccessibilityElement = true - updateAccessibilityLabel() - accessibilityTraits = .button - accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint") - updateAccessibilityLabel() + accessibilityTraits = radioButton.accessibilityTraits + accessibilityHint = radioButton.accessibilityHint + + // Update accessibility label on radio button state change. observation = observe(\.radioButton.isSelected, options: [.new]) { [weak self] _, _ in self?.updateAccessibilityLabel() } @@ -70,8 +68,7 @@ import Foundation } func updateAccessibilityLabel() { - - var message = MVMCoreUIUtility.hardcodedString(withKey: "radio_button") ?? "" + var message = "" radioButton.updateAccessibilityLabel() if let radioButtonLabel = radioButton.accessibilityLabel { message += radioButtonLabel + ", " @@ -85,6 +82,27 @@ import Foundation if let bodyLabel = eyebrowHeadlineBodyLink.body.text { message += bodyLabel } - accessibilityLabel = message + + let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 + isAccessibilityElement = !linkShowing + radioButton.isAccessibilityElement = linkShowing + eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing + + if !linkShowing { + // Make whole cell focusable if no link. + accessibilityLabel = message + } else { + // Allow only radio button and link to be focused on. + radioButton.accessibilityLabel = message + + var elements: [UIView] = [] + if message.count > 0 { + elements.append(radioButton) + } + if eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 { + elements.append(eyebrowHeadlineBodyLink.link) + } + accessibilityElements = elements + } } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift index 688f457c..7ee0b619 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift @@ -48,13 +48,11 @@ import UIKit stack.restack() eyebrowHeadlineBodyLink.body.textColor = .mvmOrangeAA eyebrowHeadlineBodyLink.headline.styleBoldBodySmall(true) - radioButton.isAccessibilityElement = false - isAccessibilityElement = true - updateAccessibilityLabel() - accessibilityTraits = .button - accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint") - updateAccessibilityLabel() + + accessibilityTraits = radioButton.accessibilityTraits + accessibilityHint = radioButton.accessibilityHint + // Update accessibility label on radio button state change. observation = observe(\.radioButton.isSelected, options: [.new]) { [weak self] _, _ in self?.updateAccessibilityLabel() } @@ -88,30 +86,44 @@ import UIKit } func updateAccessibilityLabel() { - - var message = MVMCoreUIUtility.hardcodedString(withKey: "radio_button") ?? "" - + var message = "" radioButton.updateAccessibilityLabel() if let radioButtonLabel = radioButton.accessibilityLabel { message += radioButtonLabel + ", " } - if let leftImageLabel = leftImage.accessibilityLabel { message += leftImageLabel + ", " } - if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text { message += eyebrowLabel + ", " } - if let headlineLabel = eyebrowHeadlineBodyLink.headline.text { message += headlineLabel + ", " } - if let bodyLabel = eyebrowHeadlineBodyLink.body.text { message += bodyLabel } - accessibilityLabel = message + let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 + isAccessibilityElement = !linkShowing + radioButton.isAccessibilityElement = linkShowing + eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing + + if !linkShowing { + // Make whole cell focusable if no link. + accessibilityLabel = message + } else { + // Allow only radio button and link to be focused on. + radioButton.accessibilityLabel = message + + var elements: [UIView] = [] + if message.count > 0 { + elements.append(radioButton) + } + if eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 { + elements.append(eyebrowHeadlineBodyLink.link) + } + accessibilityElements = elements + } } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyText.swift index d89604f9..189c08d0 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyText.swift @@ -44,12 +44,15 @@ open class ListLeftVariableRadioButtonBodyText: TableViewCell { addMolecule(stack) stack.restack() + + // Make the whole cell focusable. isAccessibilityElement = true radioButton.isAccessibilityElement = false - accessibilityTraits = .button - accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint") + accessibilityTraits = radioButton.accessibilityTraits + accessibilityHint = radioButton.accessibilityHint updateAccessibilityLabel() + // Update accessibility label on radio button state change. observation = observe(\.radioButton.isSelected, options: [.new]) { [weak self] _, _ in self?.updateAccessibilityLabel() } @@ -79,7 +82,7 @@ open class ListLeftVariableRadioButtonBodyText: TableViewCell { func updateAccessibilityLabel() { - var message = MVMCoreUIUtility.hardcodedString(withKey: "radio_button") ?? "" + var message = "" radioButton.updateAccessibilityLabel() if let radioButtonLabel = radioButton.accessibilityLabel { From 059696141c6e5da69485499da22d91700e93fd89 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 29 May 2020 15:51:28 -0400 Subject: [PATCH 06/44] Tab updates --- MVMCoreUI.xcodeproj/project.pbxproj | 12 ++ .../HorizontalCombinationViews/TabBar.swift | 79 +++++++++++++ .../TabBarModel.swift | 104 ++++++++++++++++++ .../TabsModel.swift | 1 - .../Atomic/Protocols/TabBarProtocol.swift | 13 +++ MVMCoreUI/BaseClasses/Button.swift | 14 ++- .../MVMCoreUISplitViewController.h | 13 +++ .../MVMCoreUISplitViewController.m | 96 ++++++---------- 8 files changed, 264 insertions(+), 68 deletions(-) create mode 100644 MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift create mode 100644 MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift create mode 100644 MVMCoreUI/Atomic/Protocols/TabBarProtocol.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 34bfd8e7..0a3c0c85 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -329,6 +329,9 @@ D28A839123CD4FD400DFE4FC /* CornerLabelsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A839023CD4FD400DFE4FC /* CornerLabelsModel.swift */; }; D28A839323CE828900DFE4FC /* HeadlineBodyCaretLinkImageModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A839223CE828900DFE4FC /* HeadlineBodyCaretLinkImageModel.swift */; }; D28BA730247EC2EB00B75CB8 /* NavigationButtomModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28BA72F247EC2EB00B75CB8 /* NavigationButtomModelProtocol.swift */; }; + D28BA741248025A300B75CB8 /* TabBarModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28BA740248025A300B75CB8 /* TabBarModel.swift */; }; + D28BA7432480284E00B75CB8 /* TabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28BA7422480284E00B75CB8 /* TabBar.swift */; }; + D28BA7452481652D00B75CB8 /* TabBarProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28BA7442481652D00B75CB8 /* TabBarProtocol.swift */; }; D296E14722A5984C0051EBE7 /* MVMCoreUIViewConstrainingProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D296E14622A597490051EBE7 /* MVMCoreUIViewConstrainingProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; D29B771022C281F400D6ACE0 /* ModuleMolecule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D29B770F22C281F400D6ACE0 /* ModuleMolecule.swift */; }; D29C94D5242901C9003813BA /* MVMCoreUICommonViewsUtility+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D29C94D4242901C9003813BA /* MVMCoreUICommonViewsUtility+Extension.swift */; }; @@ -758,6 +761,9 @@ D28A839023CD4FD400DFE4FC /* CornerLabelsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CornerLabelsModel.swift; sourceTree = ""; }; D28A839223CE828900DFE4FC /* HeadlineBodyCaretLinkImageModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodyCaretLinkImageModel.swift; sourceTree = ""; }; D28BA72F247EC2EB00B75CB8 /* NavigationButtomModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationButtomModelProtocol.swift; sourceTree = ""; }; + D28BA740248025A300B75CB8 /* TabBarModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarModel.swift; sourceTree = ""; }; + D28BA7422480284E00B75CB8 /* TabBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBar.swift; sourceTree = ""; }; + D28BA7442481652D00B75CB8 /* TabBarProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarProtocol.swift; sourceTree = ""; }; D296E14622A597490051EBE7 /* MVMCoreUIViewConstrainingProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIViewConstrainingProtocol.h; sourceTree = ""; }; D29B770F22C281F400D6ACE0 /* ModuleMolecule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModuleMolecule.swift; sourceTree = ""; }; D29C94D4242901C9003813BA /* MVMCoreUICommonViewsUtility+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MVMCoreUICommonViewsUtility+Extension.swift"; sourceTree = ""; }; @@ -1219,6 +1225,8 @@ 017BEB372360C6AC0024EF95 /* RadioButtonLabel.swift */, D28764FA245A33A500CB882D /* TwoLinkViewModel.swift */, D28764F8245A327200CB882D /* TwoLinkView.swift */, + D28BA740248025A300B75CB8 /* TabBarModel.swift */, + D28BA7422480284E00B75CB8 /* TabBar.swift */, ); path = HorizontalCombinationViews; sourceTree = ""; @@ -1868,6 +1876,7 @@ 012A88C7238DB02000FE3DA1 /* MoleculeDelegateProtocol.swift */, 017BEB47236230DB0024EF95 /* MoleculeViewProtocol.swift */, 012A88AC238C418100FE3DA1 /* TemplateProtocol.swift */, + D28BA7442481652D00B75CB8 /* TabBarProtocol.swift */, 011B58EE23A2AA850085F53C /* ModelProtocols */, ); path = Protocols; @@ -2017,6 +2026,7 @@ D264FAAA2440F97600D98315 /* CollectionView.swift in Sources */, 0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */, D2FB151D23A40F1500C20E10 /* MoleculeStackItem.swift in Sources */, + D28BA7452481652D00B75CB8 /* TabBarProtocol.swift in Sources */, AA11A41F23F15D3100D7962F /* ListRightVariablePayments.swift in Sources */, D28764AA2458980300CB882D /* ThreeLayerFillMiddleTemplate.swift in Sources */, 0116A4E5228B19640094F3ED /* RadioButtonSelectionHelper.swift in Sources */, @@ -2257,6 +2267,7 @@ D20FB165241A5D75004AFC3A /* NavigationItemModel.swift in Sources */, AA2AD118244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift in Sources */, DB06250B2293456500B72DD3 /* LeftRightLabelView.swift in Sources */, + D28BA741248025A300B75CB8 /* TabBarModel.swift in Sources */, D224798A2314445E003FCCF9 /* LabelToggle.swift in Sources */, D2A92882241AAB67004E01C6 /* ScrollingViewController.swift in Sources */, C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */, @@ -2355,6 +2366,7 @@ 0AB764D324460FA400E7FE72 /* UIPickerView+Extension.swift in Sources */, D29DF29E21E7AE3B003B2FB9 /* MFStyler.m in Sources */, 94C661D923CCF4B400D9FE5B /* LeftRightLabelModel.swift in Sources */, + D28BA7432480284E00B75CB8 /* TabBar.swift in Sources */, AA26850C244840AE00CE34CC /* HeadersH2TinyButton.swift in Sources */, 011D95AB2405C553000E3791 /* FormItemProtocol.swift in Sources */, D21EE53C23AD3AD4003D1A30 /* NSLayoutConstraintAxis+Extension.swift in Sources */, diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift new file mode 100644 index 00000000..e5233ad8 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift @@ -0,0 +1,79 @@ +// +// TabBar.swift +// MVMCoreUI +// +// Created by Scott Pfeil on 5/28/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers open class TabBar: UITabBar, MoleculeViewProtocol, TabBarProtocol, UITabBarDelegate { + + public var model: TabBarModel + public var delegateObject: MVMCoreUIDelegateObject? + + required public init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + guard let model = model as? TabBarModel else { + fatalError("model is not TabBarModel") + } + self.model = model + super.init(frame: .zero) + translatesAutoresizingMaskIntoConstraints = false + delegate = self + set(with: model, delegateObject, additionalData) + } + + required public init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + guard let model = model as? TabBarModel else { return } + self.model = model + + // Set appearance + if #available(iOS 13.0, *) { + let appearance = UITabBarAppearance() + appearance.backgroundColor = model.backgroundColor?.uiColor + setTabBarItemColors(appearance.stackedLayoutAppearance, model: model) + setTabBarItemColors(appearance.inlineLayoutAppearance, model: model) + setTabBarItemColors(appearance.compactInlineLayoutAppearance, model: model) + standardAppearance = appearance + } else { + // Fallback on earlier versions + backgroundColor = model.backgroundColor?.uiColor + tintColor = model.selectedColor.uiColor + unselectedItemTintColor = model.unSelectedColor.uiColor + barTintColor = model.backgroundColor?.uiColor + isTranslucent = false + } + + // Add buttons + var tabs: [UITabBarItem] = [] + for (index, tab) in model.tabs.enumerated() { + let tabBarItem = UITabBarItem(title: tab.title, image: UIImage(named: tab.image, in: MVMCoreCache.shared()?.bundleToUseForImages(), compatibleWith: nil), tag: index) + tabs.append(tabBarItem) + } + setItems(tabs, animated: false) + selectedItem = tabs[model.selectedTab] + } + + /// Sets the item colors. + @available(iOS 13.0, *) + private func setTabBarItemColors(_ itemAppearance: UITabBarItemAppearance, model: TabBarModel) { + itemAppearance.normal.iconColor = model.unSelectedColor.uiColor + itemAppearance.normal.titleTextAttributes = [NSAttributedString.Key.foregroundColor: model.unSelectedColor.uiColor] + + itemAppearance.selected.iconColor = model.selectedColor.uiColor + itemAppearance.selected.titleTextAttributes = [NSAttributedString.Key.foregroundColor: model.selectedColor.uiColor] + } + + // MARK: - UITabBarDelegate + public func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) { + Button.performButtonAction(with: model.tabs[item.tag].action, button: item, delegateObject: delegateObject, additionalData: nil) + } +} + +extension UITabBarItem: MFButtonProtocol { +} diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift new file mode 100644 index 00000000..1bab1265 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift @@ -0,0 +1,104 @@ +// +// TabBarModel.swift +// MVMCoreUI +// +// Created by Scott Pfeil on 5/28/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class TabBarModel: MoleculeModelProtocol { + public static var identifier: String = "tabBar" + public var backgroundColor: Color? = Color(uiColor: .white) + public var tabs: [TabBarItemModel] + public var selectedColor = Color(uiColor: .mvmBlack) + public var unSelectedColor = Color(uiColor: .mvmCoolGray3) + + // Must be capped to 0...(tabs.count - 1) + public var selectedTab: Int = 0 + + private enum CodingKeys: String, CodingKey { + case moleculeName + case backgroundColor + case tabs + case selectedColor + case unSelectedColor + case selectedTab + } + + public init(with tabs: [TabBarItemModel]) { + self.tabs = tabs + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + tabs = try typeContainer.decode([TabBarItemModel].self, forKey: .tabs) + if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) { + backgroundColor = color + } + if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .unSelectedColor) { + unSelectedColor = color + } + if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .selectedColor) { + selectedColor = color + } + if let index = try typeContainer.decodeIfPresent(Int.self, forKey: .selectedTab) { + selectedTab = index + } + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) + try container.encode(tabs, forKey: .tabs) + try container.encode(backgroundColor, forKey: .backgroundColor) + try container.encode(selectedColor, forKey: .selectedColor) + try container.encode(unSelectedColor, forKey: .unSelectedColor) + try container.encode(selectedTab, forKey: .selectedTab) + } +} + +public class TabBarItemModel: Codable { + var title: String + var image: String + var action: ActionModelProtocol + + private enum CodingKeys: String, CodingKey { + case title + case image + case action + } + + public init(with title: String, image: String, action: ActionModelProtocol) { + self.title = title + self.image = image + self.action = action + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + title = try typeContainer.decode(String.self, forKey: .title) + image = try typeContainer.decode(String.self, forKey: .image) + action = try typeContainer.decodeModel(codingKey: .action) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(title, forKey: .title) + try container.encode(image, forKey: .image) + try container.encodeModel(action, forKey: .action) + } +} + +@objc public class TabBarHelper: NSObject { + @objc public class func get() -> UITabBar { + let model = TabBarModel(with: [TabBarItemModel(with: "Home", image: "Home", action: ActionOpenPageModel(pageType: "myFeed", presentationStyle: "root", tabBarIndex: 0)), + TabBarItemModel(with: "Account", image: "Account", action: ActionOpenPageModel(pageType: "account", presentationStyle: "root", tabBarIndex: 1)), + TabBarItemModel(with: "Shop", image: "Bag", action: ActionOpenPageModel(pageType: "shop", presentationStyle: "root", tabBarIndex: 2)), + TabBarItemModel(with: "Verizon Up", image: "Verizon Up", action: ActionOpenPageModel(pageType: "vzup", presentationStyle: "root", tabBarIndex: 3)), + TabBarItemModel(with: "More", image: "More", action: ActionOpenPageModel(pageType: "more", presentationStyle: "root", tabBarIndex: 4))]) + let tabBar = TabBar(model: model, nil, nil) + return tabBar + } +} diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift index d663a703..e318b47c 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift @@ -78,5 +78,4 @@ public class TabItemModel: Codable { try container.encodeModel(label, forKey: .label) try container.encodeModelIfPresent(action, forKey: .action) } - } diff --git a/MVMCoreUI/Atomic/Protocols/TabBarProtocol.swift b/MVMCoreUI/Atomic/Protocols/TabBarProtocol.swift new file mode 100644 index 00000000..fc172d0d --- /dev/null +++ b/MVMCoreUI/Atomic/Protocols/TabBarProtocol.swift @@ -0,0 +1,13 @@ +// +// TabBarProtocol.swift +// MVMCoreUI +// +// Created by Scott Pfeil on 5/29/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objc public protocol TabBarProtocol { + +} diff --git a/MVMCoreUI/BaseClasses/Button.swift b/MVMCoreUI/BaseClasses/Button.swift index 5d42c5fb..38c48ddc 100644 --- a/MVMCoreUI/BaseClasses/Button.swift +++ b/MVMCoreUI/BaseClasses/Button.swift @@ -78,11 +78,15 @@ public typealias ButtonAction = (Button) -> () addActionBlock(event: .touchUpInside) { [weak self] sender in guard let self = self else { return } - if let data = try? actionModel.encode(using: JSONEncoder()), - let actionMap = try? JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.init()) as? [AnyHashable: Any], - delegateObject?.buttonDelegate?.button?(self, shouldPerformActionWithMap: actionMap, additionalData: additionalData) ?? true { - MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject) - } + Self.performButtonAction(with: actionModel, button: self, delegateObject: delegateObject, additionalData: additionalData) + } + } + + open class func performButtonAction(with model: ActionModelProtocol, button: MFButtonProtocol, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { + if let data = try? model.encode(using: JSONEncoder()), + let actionMap = try? JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.init()) as? [AnyHashable: Any], + delegateObject?.buttonDelegate?.button?(button, shouldPerformActionWithMap: actionMap, additionalData: additionalData) ?? true { + MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject) } } diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h index e70a8b8b..ca06471d 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h @@ -11,9 +11,11 @@ @import MVMCore.MVMCoreActionDelegateProtocol; #import #import + @class MVMCoreUITopAlertView; @class MFViewController; @class NavigationController; +@protocol TabBarProtocol; typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { MFNoDrawer = 0, @@ -47,6 +49,9 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { @property (nonatomic, readonly) BOOL rightPanelIsAccessible; @property (nullable, weak, nonatomic, readonly) UIViewController *navigationItemViewController; +/// Reference to the tabbar. +@property (weak, nonatomic) UIView *tabBar; + // Convenience getter + (nullable instancetype)mainSplitViewController; @@ -141,4 +146,12 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { - (IBAction)backButtonPressed:(nullable id)sender; - (IBAction)rightPanelButtonPressed:(nullable id)sender; +#pragma mark - TabBar + +/// Called when split view is loaded to create the initial tabbar. Default is nil. +- (nullable UIView *)createTabBar; + +/// Adds any tabbar at the bottom of the split view. +- (void)addTabBar:(nonnull UIView *)tabBar; + @end diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index 72879a98..3b0d5929 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -43,6 +43,8 @@ typedef NS_OPTIONS(NSInteger, MFExtendedDrawer) { @property (weak, nonatomic) UIView *leftPanelSeparator; @property (weak, nonatomic) UIView *rightPanelSeparator; +@property (weak, nonatomic) NSLayoutConstraint *bottomConstraint; + @property (weak, nonatomic, readwrite) NavigationController *navigationController; // A view that covers the detail view when the master is out. @@ -771,6 +773,26 @@ CGFloat const PanelAnimationDuration = 0.2; [self.view layoutIfNeeded]; } +#pragma mark - TabBar + +- (nullable UIView *)createTabBar { + return nil; +} + +- (void)addTabBar:(nonnull UIView *)tabBar { + [self.view addSubview:tabBar]; + [tabBar.topAnchor constraintEqualToAnchor:self.mainView.bottomAnchor].active = YES; + [NSLayoutConstraint constraintWithItem:tabBar attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.mainView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0].active = YES; + [NSLayoutConstraint constraintWithItem:tabBar attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.mainView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0].active = YES; + + self.bottomConstraint.active = NO; + NSLayoutConstraint *bottom = [self.view.safeAreaLayoutGuide.bottomAnchor constraintEqualToAnchor:tabBar.bottomAnchor]; + bottom.active = YES; + self.bottomConstraint = bottom; + + self.tabBar = tabBar; +} + #pragma mark - Bottom Progress Bar - (void)setBottomProgressBarProgress:(float)progress { @@ -840,27 +862,21 @@ CGFloat const PanelAnimationDuration = 0.2; bottomProgressHeight.active = YES; self.bottomProgressBarHeightConstraint = bottomProgressHeight; - UITabBar *tabs = [[UITabBar alloc] init]; - tabs.translatesAutoresizingMaskIntoConstraints = NO; - tabs.tintColor = [UIColor mfRedColor]; - tabs.backgroundColor = [UIColor whiteColor]; - NSArray *tabList = @[[[UITabBarItem alloc] initWithTitle:nil image:[[MVMCoreUIUtility imageNamed:@"Home"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] tag:0], - [[UITabBarItem alloc] initWithTitle:nil image:[[MVMCoreUIUtility imageNamed:@"Account"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] tag:1], - [[UITabBarItem alloc] initWithTitle:nil image:[[MVMCoreUIUtility imageNamed:@"Bag"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] tag:2], - [[UITabBarItem alloc] initWithTitle:nil image:[[MVMCoreUIUtility imageNamed:@"Verizon Up"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] tag:3], - [[UITabBarItem alloc] initWithTitle:nil image:[[MVMCoreUIUtility imageNamed:@"More"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] tag:4]]; - [tabs setItems:tabList animated:NO]; - [tabs setSelectedItem:tabList[0]]; - tabs.delegate = self; - [self.view addSubview:tabs]; - [NSLayoutConstraint constraintWithItem:tabs attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0].active = YES; - [NSLayoutConstraint constraintWithItem:tabs attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0].active = YES; if (topAlertView) { - [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[topAlertView]-0-[mainView]-0-[progressView]-0-[tabs]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topAlertView, mainView, progressView, tabs)]]; + [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[topAlertView]-0-[mainView]-0-[progressView]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topAlertView, mainView, progressView)]]; } else { - [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[mainView]-0-[progressView]-0-[tabs]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(mainView, progressView, tabs)]]; + [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[mainView]-0-[progressView]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(mainView, progressView)]]; + } + + // Add tabbar if we have it. + UIView *tabs = [self createTabBar]; + if (tabs) { + [self addTabBar:tabs]; + } else { + NSLayoutConstraint *bottom = [self.view.safeAreaLayoutGuide.bottomAnchor constraintEqualToAnchor:progressView.bottomAnchor]; + bottom.active = YES; + self.bottomConstraint = bottom; } - [[self.view.safeAreaLayoutGuide.bottomAnchor constraintEqualToAnchor:tabs.bottomAnchor] setActive:YES]; // Cover View UIView *coverView = [MVMCoreUICommonViewsUtility commonView]; @@ -877,50 +893,6 @@ CGFloat const PanelAnimationDuration = 0.2; [self setupPanels]; } -- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item { - switch (item.tag) { - case 0:{ - MVMCoreRequestParameters *params = [[MVMCoreRequestParameters alloc] initWithPageType:@"myFeed" extraParameters:nil]; - params.loadStyle = MFLoadStyleBecomeRoot; - params.shouldNotAnimatePush = YES; - [[MVMCoreLoadHandler sharedGlobal] loadRequest:params dataForPage:nil delegateObject:nil]; - } - break; - case 1:{ - MVMCoreRequestParameters *params = [[MVMCoreRequestParameters alloc] initWithPageType:@"accountLanding" extraParameters:nil]; - params.loadStyle = MFLoadStyleBecomeRoot; - params.shouldNotAnimatePush = YES; - [[MVMCoreLoadHandler sharedGlobal] loadRequest:params dataForPage:nil delegateObject:nil]; - } - break; - case 2:{ - MVMCoreRequestParameters *params = [[MVMCoreRequestParameters alloc] initWithPageType:@"shopHomePage" extraParameters:nil]; - params.loadStyle = MFLoadStyleBecomeRoot; - params.shouldNotAnimatePush = YES; - [[MVMCoreLoadHandler sharedGlobal] loadRequest:params dataForPage:nil delegateObject:nil]; - } - break; - case 3:{ - MVMCoreRequestParameters *params = [[MVMCoreRequestParameters alloc] initWithPageType:@"loyaltyEligibiltySelector" extraParameters:nil]; - params.loadStyle = MFLoadStyleBecomeRoot; - params.shouldNotAnimatePush = YES; - [[MVMCoreLoadHandler sharedGlobal] loadRequest:params dataForPage:nil delegateObject:nil]; - } - break; - case 4:{ - UIAlertController *controller = [UIAlertController alertControllerWithTitle:@"More" message:nil preferredStyle:UIAlertControllerStyleActionSheet]; - [controller addAction:[UIAlertAction actionWithTitle:@"Bill" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { - [[MVMCoreLoadHandler sharedGlobal] loadRequest:[[MVMCoreRequestParameters alloc] initWithPageType:@"billOverview" extraParameters:nil] dataForPage:nil delegateObject:nil]; - }]]; - [controller addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]]; - [[MVMCoreNavigationHandler sharedNavigationHandler] presentViewController:controller animated:YES]; - } - break; - default: - break; - } -} - - (void)viewDidLoad { [super viewDidLoad]; [self.topAlertView pinATopViewController:self]; From 8fcc9463c88161425e1244a35f5e3aeacae0576d Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 29 May 2020 16:02:28 -0400 Subject: [PATCH 07/44] change bar button item to convenience function --- MVMCoreUI/BaseClasses/BarButtonItem.swift | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/MVMCoreUI/BaseClasses/BarButtonItem.swift b/MVMCoreUI/BaseClasses/BarButtonItem.swift index cbb6ba2d..93eb63a3 100644 --- a/MVMCoreUI/BaseClasses/BarButtonItem.swift +++ b/MVMCoreUI/BaseClasses/BarButtonItem.swift @@ -31,11 +31,7 @@ public typealias BarButtonAction = (BarButtonItem) -> () open func set(with actionModel: ActionModelProtocol, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { buttonDelegate = delegateObject?.buttonDelegate actionDelegate?.buttonAction = { sender in - if let data = try? actionModel.encode(using: JSONEncoder()), - let actionMap = try? JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.init()) as? [AnyHashable: Any], - delegateObject?.buttonDelegate?.button?(sender, shouldPerformActionWithMap: actionMap, additionalData: additionalData) ?? true { - MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject) - } + Button.performButtonAction(with: actionModel, button: sender, delegateObject: delegateObject, additionalData: additionalData) } } From 1dfe49bde60ce4834eafd3d2858d6d398394cae6 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Mon, 1 Jun 2020 15:54:01 +0530 Subject: [PATCH 08/44] Custom flow layout implemented --- MVMCoreUI.xcodeproj/project.pbxproj | 16 +++-- .../CollectionViewCenterLayout.swift | 61 ------------------- .../CustomCollectionViewFlowLayout.swift | 34 +++++++++++ MVMCoreUI/Atomic/Atoms/Selectors/Tag.swift | 35 +++++++++++ .../Selectors/TagCollectionViewCell.swift | 10 +-- .../Atomic/Atoms/Selectors/TagModel.swift | 37 +++++++++++ .../Atomic/Atoms/Selectors/TagsList.swift | 37 +++++------ .../Atoms/Selectors/TagsListModel.swift | 15 +++-- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 2 + 9 files changed, 150 insertions(+), 97 deletions(-) delete mode 100644 MVMCoreUI/Atomic/Atoms/Selectors/CollectionViewCenterLayout.swift create mode 100644 MVMCoreUI/Atomic/Atoms/Selectors/CustomCollectionViewFlowLayout.swift create mode 100644 MVMCoreUI/Atomic/Atoms/Selectors/Tag.swift create mode 100644 MVMCoreUI/Atomic/Atoms/Selectors/TagModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index d424780e..8b6e581a 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -222,7 +222,7 @@ BB2FB3BB247E7EBC00DF73CD /* TagCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3BA247E7EBC00DF73CD /* TagCollectionViewCell.swift */; }; BB2FB3BD247E7EF200DF73CD /* TagsList.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3BC247E7EF200DF73CD /* TagsList.swift */; }; BB2FB3BF247E7F0900DF73CD /* TagsListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3BE247E7F0900DF73CD /* TagsListModel.swift */; }; - BB2FB3C1247EC1EB00DF73CD /* CollectionViewCenterLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3C0247EC1EB00DF73CD /* CollectionViewCenterLayout.swift */; }; + BB2FB3C1247EC1EB00DF73CD /* CustomCollectionViewFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3C0247EC1EB00DF73CD /* CustomCollectionViewFlowLayout.swift */; }; BB47A586241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */; }; BB47A588241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift */; }; BB54C5202434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB54C51E2434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift */; }; @@ -238,6 +238,8 @@ BBAA4F05243D8E3B005AAD5F /* RadioBoxesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBAA4F01243D8E3B005AAD5F /* RadioBoxesModel.swift */; }; BBBBC87C24374A4900B0F079 /* ListThreeColumnBillChangesDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBBBC87A24374A4900B0F079 /* ListThreeColumnBillChangesDivider.swift */; }; BBBBC87D24374A4900B0F079 /* ListThreeColumnBillChangesDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBBBC87B24374A4900B0F079 /* ListThreeColumnBillChangesDividerModel.swift */; }; + BBC0C4FD24811DBC0087C44F /* Tag.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBC0C4FC24811DBC0087C44F /* Tag.swift */; }; + BBC0C4FF24811DCA0087C44F /* TagModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBC0C4FE24811DCA0087C44F /* TagModel.swift */; }; C003506123AA94CD00B6AC29 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = C003506023AA94CD00B6AC29 /* Button.swift */; }; C07065C42395677300FBF997 /* Link.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07065C32395677300FBF997 /* Link.swift */; }; C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */; }; @@ -659,7 +661,7 @@ BB2FB3BA247E7EBC00DF73CD /* TagCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagCollectionViewCell.swift; sourceTree = ""; }; BB2FB3BC247E7EF200DF73CD /* TagsList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagsList.swift; sourceTree = ""; }; BB2FB3BE247E7F0900DF73CD /* TagsListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagsListModel.swift; sourceTree = ""; }; - BB2FB3C0247EC1EB00DF73CD /* CollectionViewCenterLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionViewCenterLayout.swift; sourceTree = ""; }; + BB2FB3C0247EC1EB00DF73CD /* CustomCollectionViewFlowLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomCollectionViewFlowLayout.swift; sourceTree = ""; }; BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsectionModel.swift; sourceTree = ""; }; BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsection.swift; sourceTree = ""; }; BB54C51E2434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableButtonAllTextAndLinks.swift; sourceTree = ""; }; @@ -675,6 +677,8 @@ BBAA4F01243D8E3B005AAD5F /* RadioBoxesModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RadioBoxesModel.swift; sourceTree = ""; }; BBBBC87A24374A4900B0F079 /* ListThreeColumnBillChangesDivider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListThreeColumnBillChangesDivider.swift; sourceTree = ""; }; BBBBC87B24374A4900B0F079 /* ListThreeColumnBillChangesDividerModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListThreeColumnBillChangesDividerModel.swift; sourceTree = ""; }; + BBC0C4FC24811DBC0087C44F /* Tag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tag.swift; sourceTree = ""; }; + BBC0C4FE24811DCA0087C44F /* TagModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagModel.swift; sourceTree = ""; }; C003506023AA94CD00B6AC29 /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = ""; }; C07065C32395677300FBF997 /* Link.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Link.swift; sourceTree = ""; }; C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnOrderedListModel.swift; sourceTree = ""; }; @@ -1441,8 +1445,10 @@ D264FAA8243FE17A00D98315 /* Selectors */ = { isa = PBXGroup; children = ( + BBC0C4FE24811DCA0087C44F /* TagModel.swift */, + BBC0C4FC24811DBC0087C44F /* Tag.swift */, BB2FB3BA247E7EBC00DF73CD /* TagCollectionViewCell.swift */, - BB2FB3C0247EC1EB00DF73CD /* CollectionViewCenterLayout.swift */, + BB2FB3C0247EC1EB00DF73CD /* CustomCollectionViewFlowLayout.swift */, BB2FB3BC247E7EF200DF73CD /* TagsList.swift */, BB2FB3BE247E7F0900DF73CD /* TagsListModel.swift */, D264FAAB2441009400D98315 /* RadioBoxCollectionViewCell.swift */, @@ -2033,6 +2039,7 @@ 94C2D9A923872E5E0006CF46 /* LabelAttributeImageModel.swift in Sources */, DBC4391922442197001AB423 /* DashLine.swift in Sources */, D264FAAA2440F97600D98315 /* CollectionView.swift in Sources */, + BBC0C4FF24811DCA0087C44F /* TagModel.swift in Sources */, 0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */, D2FB151D23A40F1500C20E10 /* MoleculeStackItem.swift in Sources */, AA11A41F23F15D3100D7962F /* ListRightVariablePayments.swift in Sources */, @@ -2198,7 +2205,7 @@ D260105D23D0BCD400764D80 /* Stack.swift in Sources */, 0A7EF85D23D8A95600B2AAD1 /* TextEntryFieldModel.swift in Sources */, BB54C5212434D92F0038326C /* ListRightVariableButtonAllTextAndLinksModel.swift in Sources */, - BB2FB3C1247EC1EB00DF73CD /* CollectionViewCenterLayout.swift in Sources */, + BB2FB3C1247EC1EB00DF73CD /* CustomCollectionViewFlowLayout.swift in Sources */, D2092349244A51D40044AD09 /* RadioSwatchModel.swift in Sources */, 8DD1E370243B3D0500D8F2DF /* ListThreeColumnInternationalData.swift in Sources */, D23EA802247EBED400D60C34 /* ImageBarButtonItem.swift in Sources */, @@ -2232,6 +2239,7 @@ 011B58F223A2AE2C0085F53C /* DropDownListItemModel.swift in Sources */, D2509ED12472ED9B001BFB9D /* NavigationItemModelProtocol.swift in Sources */, 8D448E5524050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */, + BBC0C4FD24811DBC0087C44F /* Tag.swift in Sources */, 94C2D9842386F3F80006CF46 /* LabelAttributeModel.swift in Sources */, 944589212385D6E900DE9FD4 /* DashLineModel.swift in Sources */, D2E2A99623D8CF85000B42E6 /* HeadlineBodyLinkToggleModel.swift in Sources */, diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/CollectionViewCenterLayout.swift b/MVMCoreUI/Atomic/Atoms/Selectors/CollectionViewCenterLayout.swift deleted file mode 100644 index 671629b9..00000000 --- a/MVMCoreUI/Atomic/Atoms/Selectors/CollectionViewCenterLayout.swift +++ /dev/null @@ -1,61 +0,0 @@ -// -// CollectionViewCenterLayout.swift -// MVMCoreUI -// -// Created by Dhamodaram Nandi on 27/05/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import UIKit - -class CollectionViewRow { - var attributes = [UICollectionViewLayoutAttributes]() - var spacing: CGFloat = 0 - - - - init(spacing: CGFloat) { - self.spacing = spacing - } - - func add(attribute: UICollectionViewLayoutAttributes) { - attributes.append(attribute) - } - - var rowWidth: CGFloat { - return attributes.reduce(0, { result, attribute -> CGFloat in - return result + attribute.frame.width - }) + CGFloat(attributes.count - 1) * spacing - } - - func centerLayout(collectionViewWidth: CGFloat) { - let padding = (collectionViewWidth - rowWidth) / 2 - var offset = padding - for attribute in attributes { - attribute.frame.origin.x = offset - offset += attribute.frame.width + spacing - } - } -} - -class UICollectionViewCenterLayout: UICollectionViewFlowLayout { - override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { - guard let attributes = super.layoutAttributesForElements(in: rect) else { - return nil - } - - var rows = [CollectionViewRow]() - var currentRowY: CGFloat = -1 - - for attribute in attributes { - if currentRowY != attribute.frame.origin.y { - currentRowY = attribute.frame.origin.y - rows.append(CollectionViewRow(spacing: 10)) - } - rows.last?.add(attribute: attribute) - } - - rows.forEach { $0.centerLayout(collectionViewWidth: collectionView?.frame.width ?? 0) } - return rows.flatMap { $0.attributes } - } -} diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/CustomCollectionViewFlowLayout.swift b/MVMCoreUI/Atomic/Atoms/Selectors/CustomCollectionViewFlowLayout.swift new file mode 100644 index 00000000..aadad8b9 --- /dev/null +++ b/MVMCoreUI/Atomic/Atoms/Selectors/CustomCollectionViewFlowLayout.swift @@ -0,0 +1,34 @@ +// +// CollectionViewCenterLayout.swift +// MVMCoreUI +// +// Created by Dhamodaram Nandi on 27/05/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import UIKit + + +class UICollectionViewCenterLayout: UICollectionViewFlowLayout { + + override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { + let attributesForElementsInRect = super.layoutAttributesForElements(in: rect) + var newAttributesForElementsInRect = [UICollectionViewLayoutAttributes]() + + var leftMargin: CGFloat = 0.0; + + for attributes in attributesForElementsInRect! { + if (attributes.frame.origin.x == self.sectionInset.left) { + leftMargin = self.sectionInset.left + } else { + var newLeftAlignedFrame = attributes.frame + newLeftAlignedFrame.origin.x = leftMargin + attributes.frame = newLeftAlignedFrame + } + leftMargin += attributes.frame.size.width + 8 + newAttributesForElementsInRect.append(attributes) + } + + return newAttributesForElementsInRect + } +} diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/Tag.swift b/MVMCoreUI/Atomic/Atoms/Selectors/Tag.swift new file mode 100644 index 00000000..cd66ff12 --- /dev/null +++ b/MVMCoreUI/Atomic/Atoms/Selectors/Tag.swift @@ -0,0 +1,35 @@ +// +// Tag.swift +// MVMCoreUI +// +// Created by Dhamodaram Nandi on 29/05/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +@objcMembers open class Tag: View { + + public let label = Label.createLabelRegularBodySmall(true) + + // MARK: - MVMCoreViewProtocol + open override func setupView() { + super.setupView() + layer.borderColor = UIColor.mvmCoolGray6.cgColor + layer.borderWidth = 1 + label.numberOfLines = 1 + addSubview(label) + NSLayoutConstraint.constraintPinSubview(label, pinTop: true, topConstant: 13, pinBottom: true, bottomConstant: 13, pinLeft: true, leftConstant: 15, pinRight: true, rightConstant: 15) + + } + + // MARK: - MoleculeViewProtocol + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + guard let model = model as? TagModel else { return } + label.set(with: model.label, delegateObject, additionalData) + } + + @objc override open func updateView(_ size: CGFloat) { + super.updateView(size) + } + +} diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagCollectionViewCell.swift b/MVMCoreUI/Atomic/Atoms/Selectors/TagCollectionViewCell.swift index 086530f0..11ce0bff 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/TagCollectionViewCell.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/TagCollectionViewCell.swift @@ -8,7 +8,7 @@ import Foundation open class TagCollectionViewCell: CollectionViewCell { - public let tagLabel = Label() + public let tagLabel = Tag() open override func reset() { super.reset() @@ -17,16 +17,12 @@ open class TagCollectionViewCell: CollectionViewCell { open override func setupView() { super.setupView() - layer.borderColor = UIColor.mvmCoolGray6.cgColor - layer.borderWidth = 1 - - tagLabel.numberOfLines = 0 addMolecule(tagLabel) - MVMCoreUIUtility.setMarginsFor(contentView, leading: 15, top: 13, trailing: 15, bottom: 13) + MVMCoreUIUtility.setMarginsFor(contentView, leading: 0, top: 0, trailing: 0, bottom: 0) } open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { - guard let model = model as? LabelModel else { return } + guard let model = model as? TagModel else { return } tagLabel.set(with: model, delegateObject, additionalData) } } diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagModel.swift b/MVMCoreUI/Atomic/Atoms/Selectors/TagModel.swift new file mode 100644 index 00000000..b2154925 --- /dev/null +++ b/MVMCoreUI/Atomic/Atoms/Selectors/TagModel.swift @@ -0,0 +1,37 @@ +// +// TagModel.swift +// MVMCoreUI +// +// Created by Dhamodaram Nandi on 29/05/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +@objcMembers public class TagModel: MoleculeModelProtocol { + public static var identifier: String = "tag" + public var label: LabelModel + public var action: ActionModelProtocol + public var backgroundColor: Color? + + private enum CodingKeys: String, CodingKey { + case moleculeName + case label + case action + case backgroundColor + + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + label = try typeContainer.decode(LabelModel.self, forKey: .label) + action = try typeContainer.decodeModel(codingKey: .action) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) + try container.encode(label, forKey: .label) + try container.encodeModel(action, forKey: .action) + + } +} diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift b/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift index 0f582017..46bad4ac 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift @@ -15,13 +15,13 @@ open class TagsList: View { private var tagsListModel: TagsListModel? { return model as? TagsListModel } - + private var delegateObject: MVMCoreUIDelegateObject? /// The models for the molecules. - public var tags: [LabelModel]? - - + public var tags: [TagModel]? + + open override func layoutSubviews() { super.layoutSubviews() // Accounts for any collection size changes @@ -48,8 +48,11 @@ open class TagsList: View { guard let tagsListModel = model as? TagsListModel else { return } tags = tagsListModel.tags registerCells() - setHeight() collectionView.reloadData() + if let height = tagsListModel.height { + collectionViewHeight?.constant = CGFloat(height) + collectionViewHeight?.isActive = true + } } @objc override open func updateView(_ size: CGFloat) { @@ -61,14 +64,14 @@ open class TagsList: View { /// Creates the layout for the collection. open func createCollectionViewLayout() -> UICollectionViewLayout { - let layout = UICollectionViewFlowLayout() + let layout = UICollectionViewCenterLayout() layout.scrollDirection = .vertical layout.estimatedItemSize = CGSize(width: 140, height: 40) layout.minimumLineSpacing = 24.0 layout.minimumInteritemSpacing = itemSpacing return layout } - + /// Creates the collection view. open func createCollectionView() -> CollectionView { let collection = CollectionView(frame: .zero, collectionViewLayout: createCollectionViewLayout()) @@ -81,15 +84,15 @@ open class TagsList: View { open func registerCells() { collectionView.register(TagCollectionViewCell.self, forCellWithReuseIdentifier: "TagCollectionViewCell") } - + // MARK: - JSON Setters open func setHeight() { - + let height = collectionView.collectionViewLayout.collectionViewContentSize.height + collectionViewHeight.constant = height + } } - - extension TagsList: UICollectionViewDataSource { open func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return tags?.count ?? 0 @@ -98,7 +101,7 @@ extension TagsList: UICollectionViewDataSource { open func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { guard let molecule = tags?[indexPath.row], let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "TagCollectionViewCell", for: indexPath) as? TagCollectionViewCell else { - fatalError() + fatalError() } cell.reset() cell.set(with: molecule, delegateObject, nil) @@ -108,13 +111,13 @@ extension TagsList: UICollectionViewDataSource { } extension TagsList: UICollectionViewDelegate { - - open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - + guard let tagModel = tags?[indexPath.row] else {return} + if let data = try? tagModel.action.encode(using: JSONEncoder()), + let actionMap = try? JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.init()) as? [AnyHashable: Any]{ + MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: nil, delegateObject: delegateObject) + } } - - } diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift b/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift index 4784c381..0f3eeeab 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift @@ -12,24 +12,24 @@ import Foundation public var backgroundColor: Color? public static var identifier: String = "tagsList" - public var tags: [LabelModel] + public var tags: [TagModel] public var borderColor: Color? - + public var height: Float? + private enum CodingKeys: String, CodingKey { case moleculeName case borderColor case backgroundColor case tags - + case height } required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) borderColor = try typeContainer.decodeIfPresent(Color.self, forKey: .borderColor) - tags = try typeContainer.decode([LabelModel].self, forKey: .tags) + tags = try typeContainer.decode([TagModel].self, forKey: .tags) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) - - + height = try typeContainer.decodeIfPresent(Float.self, forKey: .height) } public func encode(to encoder: Encoder) throws { @@ -38,7 +38,6 @@ import Foundation try container.encode(tags, forKey: .tags) try container.encodeIfPresent(borderColor, forKey: .borderColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) - - + try container.encode(height, forKey: .height) } } diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index df74e2a4..b95d0d40 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -74,6 +74,8 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: Checkbox.self, viewModelClass: CheckboxModel.self) MoleculeObjectMapping.shared()?.register(viewClass: RadioSwatches.self, viewModelClass: RadioSwatchesModel.self) MoleculeObjectMapping.shared()?.register(viewClass: TagsList.self, viewModelClass: TagsListModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: Tag.self, viewModelClass: TagModel.self) + // Other Atoms From 4ae51e4c84c11cbb7cf8b528bd3cc165491057dd Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Mon, 1 Jun 2020 19:33:11 +0530 Subject: [PATCH 09/44] removed border llogic --- MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift | 8 +------- MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift | 4 ---- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift b/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift index 46bad4ac..2be81d56 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift @@ -84,13 +84,7 @@ open class TagsList: View { open func registerCells() { collectionView.register(TagCollectionViewCell.self, forCellWithReuseIdentifier: "TagCollectionViewCell") } - - // MARK: - JSON Setters - open func setHeight() { - let height = collectionView.collectionViewLayout.collectionViewContentSize.height - collectionViewHeight.constant = height - - } + } extension TagsList: UICollectionViewDataSource { diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift b/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift index 0f3eeeab..ff24c236 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift @@ -13,12 +13,10 @@ import Foundation public var backgroundColor: Color? public static var identifier: String = "tagsList" public var tags: [TagModel] - public var borderColor: Color? public var height: Float? private enum CodingKeys: String, CodingKey { case moleculeName - case borderColor case backgroundColor case tags case height @@ -26,7 +24,6 @@ import Foundation required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - borderColor = try typeContainer.decodeIfPresent(Color.self, forKey: .borderColor) tags = try typeContainer.decode([TagModel].self, forKey: .tags) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) height = try typeContainer.decodeIfPresent(Float.self, forKey: .height) @@ -36,7 +33,6 @@ import Foundation var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(moleculeName, forKey: .moleculeName) try container.encode(tags, forKey: .tags) - try container.encodeIfPresent(borderColor, forKey: .borderColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encode(height, forKey: .height) } From 3b12f5942a2408399cbb2510149be99027a67751 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Mon, 1 Jun 2020 19:53:55 +0530 Subject: [PATCH 10/44] action model protocol make its to optional --- MVMCoreUI/Atomic/Atoms/Selectors/TagModel.swift | 6 +++--- MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagModel.swift b/MVMCoreUI/Atomic/Atoms/Selectors/TagModel.swift index b2154925..a6ee8685 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/TagModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/TagModel.swift @@ -10,7 +10,7 @@ import Foundation @objcMembers public class TagModel: MoleculeModelProtocol { public static var identifier: String = "tag" public var label: LabelModel - public var action: ActionModelProtocol + public var action: ActionModelProtocol? public var backgroundColor: Color? private enum CodingKeys: String, CodingKey { @@ -24,14 +24,14 @@ import Foundation required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) label = try typeContainer.decode(LabelModel.self, forKey: .label) - action = try typeContainer.decodeModel(codingKey: .action) + action = try typeContainer.decodeModelIfPresent(codingKey: .action) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(moleculeName, forKey: .moleculeName) try container.encode(label, forKey: .label) - try container.encodeModel(action, forKey: .action) + try container.encodeModelIfPresent(action, forKey: .action) } } diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift b/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift index 2be81d56..f79d4290 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift @@ -108,7 +108,7 @@ extension TagsList: UICollectionViewDelegate { open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { guard let tagModel = tags?[indexPath.row] else {return} - if let data = try? tagModel.action.encode(using: JSONEncoder()), + if let data = try? tagModel.action?.encode(using: JSONEncoder()), let actionMap = try? JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.init()) as? [AnyHashable: Any]{ MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: nil, delegateObject: delegateObject) } From d6761c055e22e78b189ad7e68f3e510d2a94ea5a Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 1 Jun 2020 11:45:47 -0400 Subject: [PATCH 11/44] tab bar selection logic --- .../HorizontalCombinationViews/TabBar.swift | 12 ++++++++++ .../Atomic/Protocols/TabBarProtocol.swift | 4 ++++ .../BaseControllers/ViewController.swift | 23 ++++++++++++++++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift index e5233ad8..a99d820f 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift @@ -73,6 +73,18 @@ import Foundation public func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) { Button.performButtonAction(with: model.tabs[item.tag].action, button: item, delegateObject: delegateObject, additionalData: nil) } + + // MARK: - TabBarProtocol + public func highlightTab(at index: Int) { + guard let newSelectedItem = items?[model.selectedTab] else { return } + selectedItem = newSelectedItem + } + + public func selectTab(at index: Int) { + guard let newSelectedItem = items?[model.selectedTab] else { return } + selectedItem = newSelectedItem + tabBar(self, didSelect: newSelectedItem) + } } extension UITabBarItem: MFButtonProtocol { diff --git a/MVMCoreUI/Atomic/Protocols/TabBarProtocol.swift b/MVMCoreUI/Atomic/Protocols/TabBarProtocol.swift index fc172d0d..1bf79795 100644 --- a/MVMCoreUI/Atomic/Protocols/TabBarProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/TabBarProtocol.swift @@ -9,5 +9,9 @@ import Foundation @objc public protocol TabBarProtocol { + /// Should visually select the given tab index. + @objc func highlightTab(at index: Int) + /// Should select the tab index. As if the user selected it. + @objc func selectTab(at index: Int) } diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index 6ec63c24..92f26569 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -8,7 +8,7 @@ import UIKit -@objc open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMCoreViewManagerViewControllerProtocol, MoleculeDelegateProtocol, FormHolderProtocol, MVMCoreActionDelegateProtocol, UITextFieldDelegate, UITextViewDelegate, ObservingTextFieldDelegate { +@objc open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMCoreViewManagerViewControllerProtocol, MoleculeDelegateProtocol, FormHolderProtocol, MVMCoreActionDelegateProtocol, MVMCoreLoadDelegateProtocol, UITextFieldDelegate, UITextViewDelegate, ObservingTextFieldDelegate { @objc public var pageType: String? @objc public var loadObject: MVMCoreLoadObject? public var pageModel: MVMControllerModelProtocol? @@ -371,6 +371,27 @@ import UIKit MVMCoreUILoggingHandler.shared()?.defaultLogPageState(forController: self) } + // MARK: - MVMCoreLoadDelegateProtocol + // TODO: Move this function out of here after breaking down load operation into smaller tasks and remove protocol from base. + open func loadFinished(_ loadObject: MVMCoreLoadObject?, loadedViewController: (UIViewController & MVMCoreViewControllerProtocol)?, error: MVMCoreErrorObject?) { + + MVMCoreUILoggingHandler.log(withDelegateLoadFinished: loadObject, loadedViewController: loadedViewController, error: error) + + // Open the support panel + if error == nil, + loadObject?.requestParameters?.openSupportPanel ?? (loadObject?.systemParametersJSON?.boolForKey(KeyOpenSupport) ?? false) == true { + MVMCoreUISession.sharedGlobal()?.splitViewController?.showRightPanel(animated: true) + } + + // Selects the tab if needed. + if let tab: Int = loadObject?.pageJSON?["tabBarIndex"] as? Int { + MVMCoreUISplitViewController.main()?.tabBar.highlightTab(at: tab) + } else if let tab: Int = loadObject?.requestParameters?.actionMap?["tabBarIndex"] as? Int, + error == nil { + MVMCoreUISplitViewController.main()?.tabBar.highlightTab(at: tab) + } + } + // MARK: - MVMCoreActionDelegateProtocol open func handleOpenPage(for requestParameters: MVMCoreRequestParameters, actionInformation: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?) { formValidator?.addFormParams(requestParameters: requestParameters) From 40240f45019eebb8293963af9806348b0eafc8e9 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 1 Jun 2020 11:59:28 -0400 Subject: [PATCH 12/44] fix to bottom anchor --- .../SplitViewController/MVMCoreUISplitViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index 3b0d5929..054fb88d 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -873,7 +873,7 @@ CGFloat const PanelAnimationDuration = 0.2; if (tabs) { [self addTabBar:tabs]; } else { - NSLayoutConstraint *bottom = [self.view.safeAreaLayoutGuide.bottomAnchor constraintEqualToAnchor:progressView.bottomAnchor]; + NSLayoutConstraint *bottom = [self.view.bottomAnchor constraintEqualToAnchor:progressView.bottomAnchor]; bottom.active = YES; self.bottomConstraint = bottom; } From 5227f53776fe68b27f33b2c76dfcffb5f286f82c Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 1 Jun 2020 13:53:08 -0400 Subject: [PATCH 13/44] view will appear tab change thread protection --- .../HorizontalCombinationViews/TabBar.swift | 14 +++++++++----- MVMCoreUI/BaseControllers/ViewController.swift | 18 ++++++++++++------ .../MVMCoreUISplitViewController.m | 10 +++++----- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift index a99d820f..9d5ab9a5 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift @@ -76,14 +76,18 @@ import Foundation // MARK: - TabBarProtocol public func highlightTab(at index: Int) { - guard let newSelectedItem = items?[model.selectedTab] else { return } - selectedItem = newSelectedItem + MVMCoreDispatchUtility.performBlock(onMainThread: { + guard let newSelectedItem = self.items?[index] else { return } + self.selectedItem = newSelectedItem + }) } public func selectTab(at index: Int) { - guard let newSelectedItem = items?[model.selectedTab] else { return } - selectedItem = newSelectedItem - tabBar(self, didSelect: newSelectedItem) + MVMCoreDispatchUtility.performBlock(onMainThread: { + guard let newSelectedItem = self.items?[index] else { return } + self.selectedItem = newSelectedItem + self.tabBar(self, didSelect: newSelectedItem) + }) } } diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index 92f26569..51fc1b56 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -314,6 +314,11 @@ import UIKit open override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + // Select tab if needed. + if let tab: Int = loadObject?.pageJSON?["tabBarIndex"] as? Int { + MVMCoreUISplitViewController.main()?.tabBar.highlightTab(at: tab) + } + // Update the navigation bar ui when view is appearing. Can remove check in the future, see viewControllerReady if manager == nil { setNavigationController() @@ -383,12 +388,13 @@ import UIKit MVMCoreUISession.sharedGlobal()?.splitViewController?.showRightPanel(animated: true) } - // Selects the tab if needed. - if let tab: Int = loadObject?.pageJSON?["tabBarIndex"] as? Int { - MVMCoreUISplitViewController.main()?.tabBar.highlightTab(at: tab) - } else if let tab: Int = loadObject?.requestParameters?.actionMap?["tabBarIndex"] as? Int, - error == nil { - MVMCoreUISplitViewController.main()?.tabBar.highlightTab(at: tab) + // Selects the tab if needed. Page driven takes priority over action driven (see viewWillAppear) + if let tab: Int = loadObject?.requestParameters?.actionMap?["tabBarIndex"] as? Int, + error == nil, + loadObject?.pageJSON?["tabBarIndex"] == nil { + MVMCoreDispatchUtility.performBlock(onMainThread: { + MVMCoreUISplitViewController.main()?.tabBar.highlightTab(at: tab) + }) } } diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index 054fb88d..b46bb184 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -718,7 +718,7 @@ CGFloat const PanelAnimationDuration = 0.2; self.leftPanelWidth = leftPanelWidth; [NSLayoutConstraint constraintWithItem:self.mainView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.leftView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0].active = YES; [NSLayoutConstraint constraintWithItem:self.leftView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.mainView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0].active = YES; - [NSLayoutConstraint constraintWithItem:self.leftView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.mainView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES; + [NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.leftView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES; if ([panel respondsToSelector:@selector(buttonForPanel)]) { self.leftPanelButton = [panel buttonForPanel]; @@ -753,7 +753,7 @@ CGFloat const PanelAnimationDuration = 0.2; self.rightPanelWidth = rightPanelWidth; [NSLayoutConstraint constraintWithItem:self.rightView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.mainView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0].active = YES; [NSLayoutConstraint constraintWithItem:self.rightView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.mainView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0].active = YES; - [NSLayoutConstraint constraintWithItem:self.rightView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.mainView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES; + [NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.rightView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES; if ([panel respondsToSelector:@selector(buttonForPanel)]) { self.rightPanelButton = [panel buttonForPanel]; @@ -780,7 +780,7 @@ CGFloat const PanelAnimationDuration = 0.2; } - (void)addTabBar:(nonnull UIView *)tabBar { - [self.view addSubview:tabBar]; + [self.view insertSubview:tabBar atIndex:0]; [tabBar.topAnchor constraintEqualToAnchor:self.mainView.bottomAnchor].active = YES; [NSLayoutConstraint constraintWithItem:tabBar attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.mainView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0].active = YES; [NSLayoutConstraint constraintWithItem:tabBar attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.mainView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0].active = YES; @@ -887,8 +887,8 @@ CGFloat const PanelAnimationDuration = 0.2; self.mainViewCoverView = coverView; [NSLayoutConstraint constraintWithItem:coverView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0].active = YES; [NSLayoutConstraint constraintWithItem:coverView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0].active = YES; - [NSLayoutConstraint constraintWithItem:coverView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0].active = YES; - [NSLayoutConstraint constraintWithItem:coverView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES; + [NSLayoutConstraint constraintWithItem:coverView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0].active = YES; + [NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:coverView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES; [self setupPanels]; } From e8d74bf0a50e3ef01c933c085d3ff28ef86ef827 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 1 Jun 2020 15:06:42 -0400 Subject: [PATCH 14/44] Setup listener for tab response --- .../HorizontalCombinationViews/TabBarModel.swift | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift index 1bab1265..0afb5ff5 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift @@ -90,15 +90,3 @@ public class TabBarItemModel: Codable { try container.encodeModel(action, forKey: .action) } } - -@objc public class TabBarHelper: NSObject { - @objc public class func get() -> UITabBar { - let model = TabBarModel(with: [TabBarItemModel(with: "Home", image: "Home", action: ActionOpenPageModel(pageType: "myFeed", presentationStyle: "root", tabBarIndex: 0)), - TabBarItemModel(with: "Account", image: "Account", action: ActionOpenPageModel(pageType: "account", presentationStyle: "root", tabBarIndex: 1)), - TabBarItemModel(with: "Shop", image: "Bag", action: ActionOpenPageModel(pageType: "shop", presentationStyle: "root", tabBarIndex: 2)), - TabBarItemModel(with: "Verizon Up", image: "Verizon Up", action: ActionOpenPageModel(pageType: "vzup", presentationStyle: "root", tabBarIndex: 3)), - TabBarItemModel(with: "More", image: "More", action: ActionOpenPageModel(pageType: "more", presentationStyle: "root", tabBarIndex: 4))]) - let tabBar = TabBar(model: model, nil, nil) - return tabBar - } -} From c5664d80e4eea93e8bd80ee89d44c632d6694743 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 1 Jun 2020 17:20:17 -0400 Subject: [PATCH 15/44] Tabs update --- MVMCoreUI.xcodeproj/project.pbxproj | 4 +++ .../ModelProtocols/TabPageModelProtocol.swift | 14 ++++++++++ .../Atomic/Templates/TemplateModel.swift | 13 +++++++++- .../BaseControllers/ViewController.swift | 22 +++++++++++----- .../MVMCoreUISplitViewController.h | 5 +++- .../MVMCoreUISplitViewController.m | 26 ++++++++++++------- 6 files changed, 66 insertions(+), 18 deletions(-) create mode 100644 MVMCoreUI/Atomic/Protocols/ModelProtocols/TabPageModelProtocol.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index ba6f08bd..331da73c 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -334,6 +334,7 @@ D28BA741248025A300B75CB8 /* TabBarModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28BA740248025A300B75CB8 /* TabBarModel.swift */; }; D28BA7432480284E00B75CB8 /* TabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28BA7422480284E00B75CB8 /* TabBar.swift */; }; D28BA7452481652D00B75CB8 /* TabBarProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28BA7442481652D00B75CB8 /* TabBarProtocol.swift */; }; + D28BA74D248589C800B75CB8 /* TabPageModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28BA74C248589C800B75CB8 /* TabPageModelProtocol.swift */; }; D296E14722A5984C0051EBE7 /* MVMCoreUIViewConstrainingProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D296E14622A597490051EBE7 /* MVMCoreUIViewConstrainingProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; D29B771022C281F400D6ACE0 /* ModuleMolecule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D29B770F22C281F400D6ACE0 /* ModuleMolecule.swift */; }; D29C94D5242901C9003813BA /* MVMCoreUICommonViewsUtility+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D29C94D4242901C9003813BA /* MVMCoreUICommonViewsUtility+Extension.swift */; }; @@ -768,6 +769,7 @@ D28BA740248025A300B75CB8 /* TabBarModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarModel.swift; sourceTree = ""; }; D28BA7422480284E00B75CB8 /* TabBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBar.swift; sourceTree = ""; }; D28BA7442481652D00B75CB8 /* TabBarProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarProtocol.swift; sourceTree = ""; }; + D28BA74C248589C800B75CB8 /* TabPageModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabPageModelProtocol.swift; sourceTree = ""; }; D296E14622A597490051EBE7 /* MVMCoreUIViewConstrainingProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIViewConstrainingProtocol.h; sourceTree = ""; }; D29B770F22C281F400D6ACE0 /* ModuleMolecule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModuleMolecule.swift; sourceTree = ""; }; D29C94D4242901C9003813BA /* MVMCoreUICommonViewsUtility+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MVMCoreUICommonViewsUtility+Extension.swift"; sourceTree = ""; }; @@ -904,6 +906,7 @@ D2E2A9A223E096B1000B42E6 /* DisableableModelProtocol.swift */, D2092354244FA0FD0044AD09 /* ThreeLayerTemplateModelProtocol.swift */, D2509ED02472ED9B001BFB9D /* NavigationItemModelProtocol.swift */, + D28BA74C248589C800B75CB8 /* TabPageModelProtocol.swift */, ); path = ModelProtocols; sourceTree = ""; @@ -2100,6 +2103,7 @@ BB1D17E0244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift in Sources */, D29DF2CF21E7C104003B2FB9 /* MFLoadingViewController.m in Sources */, D28A837B23C928DA00DFE4FC /* MoleculeListCellProtocol.swift in Sources */, + D28BA74D248589C800B75CB8 /* TabPageModelProtocol.swift in Sources */, 014AA72F23C5059B006F3E93 /* ThreeLayerPageTemplateModel.swift in Sources */, 0A21DB91235E0EDB00C160A2 /* DigitBox.swift in Sources */, BBAA4F04243D8E3B005AAD5F /* RadioBoxModel.swift in Sources */, diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/TabPageModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/TabPageModelProtocol.swift new file mode 100644 index 00000000..dbee61bd --- /dev/null +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/TabPageModelProtocol.swift @@ -0,0 +1,14 @@ +// +// TabPageModelProtocol.swift +// MVMCoreUI +// +// Created by Scott Pfeil on 6/1/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public protocol TabPageModelProtocol { + var tabBarHidden: Bool { get set } + var tabBarIndex: Int? { get set } +} diff --git a/MVMCoreUI/Atomic/Templates/TemplateModel.swift b/MVMCoreUI/Atomic/Templates/TemplateModel.swift index b478167d..01753414 100644 --- a/MVMCoreUI/Atomic/Templates/TemplateModel.swift +++ b/MVMCoreUI/Atomic/Templates/TemplateModel.swift @@ -9,7 +9,7 @@ import Foundation -@objcMembers public class TemplateModel: MVMControllerModelProtocol { +@objcMembers public class TemplateModel: MVMControllerModelProtocol, TabPageModelProtocol { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- @@ -29,6 +29,9 @@ import Foundation public var navigationBar: (NavigationItemModelProtocol & MoleculeModelProtocol)? public var formRules: [FormGroupRule]? public var behaviors: [PageBehaviorProtocol]? + + public var tabBarHidden: Bool = false + public var tabBarIndex: Int? //-------------------------------------------------- // MARK: - Initializer @@ -50,6 +53,8 @@ import Foundation case formRules case behaviors case navigationBar + case tabBarHidden + case tabBarIndex } //-------------------------------------------------- @@ -64,6 +69,10 @@ import Foundation formRules = try typeContainer.decodeIfPresent([FormGroupRule].self, forKey: .formRules) behaviors = try typeContainer.decodeModelsIfPresent(codingKey: .behaviors) navigationBar = try typeContainer.decodeModelIfPresent(codingKey: .navigationBar) + if let tabBarHidden = try typeContainer.decodeIfPresent(Bool.self, forKey: .tabBarHidden) { + self.tabBarHidden = tabBarHidden + } + tabBarIndex = try typeContainer.decodeIfPresent(Int.self, forKey: .tabBarIndex) } public func encode(to encoder: Encoder) throws { @@ -74,5 +83,7 @@ import Foundation try container.encodeIfPresent(screenHeading, forKey: .screenHeading) try container.encodeIfPresent(formRules, forKey: .formRules) try container.encodeModelIfPresent(navigationBar, forKey: .navigationBar) + try container.encode(tabBarHidden, forKey: .tabBarHidden) + try container.encodeIfPresent(tabBarIndex, forKey: .tabBarIndex) } } diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index 51fc1b56..717a5761 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -259,6 +259,16 @@ import UIKit MVMCoreUISplitViewController.main()?.setBottomProgressBarProgress(progress / Float(100)) } } + + // MARK: - TabBar + open func updateTabBar() { + guard MVMCoreUISplitViewController.main()?.getCurrentDetailViewController() == self, + var tabModel = pageModel as? TabPageModelProtocol else { return } + if let index = tabModel.tabBarIndex { + MVMCoreUISplitViewController.main()?.tabBar?.highlightTab(at: index) + } + MVMCoreUISplitViewController.main()?.updateTabBarShowing(!tabModel.tabBarHidden) + } // MARK: - View lifecycle @@ -314,11 +324,6 @@ import UIKit open override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - // Select tab if needed. - if let tab: Int = loadObject?.pageJSON?["tabBarIndex"] as? Int { - MVMCoreUISplitViewController.main()?.tabBar.highlightTab(at: tab) - } - // Update the navigation bar ui when view is appearing. Can remove check in the future, see viewControllerReady if manager == nil { setNavigationController() @@ -328,6 +333,9 @@ import UIKit open override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) + // Update tab if needed. + updateTabBar() + if manager == nil { MVMCoreUISession.sharedGlobal()?.currentPageType = pageType MVMCoreUILoggingHandler.shared()?.defaultLogPageState(forController: self) @@ -377,7 +385,7 @@ import UIKit } // MARK: - MVMCoreLoadDelegateProtocol - // TODO: Move this function out of here after breaking down load operation into smaller tasks and remove protocol from base. + // TODO: Move this function out of here after architecture cleanup. open func loadFinished(_ loadObject: MVMCoreLoadObject?, loadedViewController: (UIViewController & MVMCoreViewControllerProtocol)?, error: MVMCoreErrorObject?) { MVMCoreUILoggingHandler.log(withDelegateLoadFinished: loadObject, loadedViewController: loadedViewController, error: error) @@ -393,7 +401,7 @@ import UIKit error == nil, loadObject?.pageJSON?["tabBarIndex"] == nil { MVMCoreDispatchUtility.performBlock(onMainThread: { - MVMCoreUISplitViewController.main()?.tabBar.highlightTab(at: tab) + MVMCoreUISplitViewController.main()?.tabBar?.highlightTab(at: tab) }) } } diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h index ca06471d..4d6b2cff 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h @@ -50,7 +50,7 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { @property (nullable, weak, nonatomic, readonly) UIViewController *navigationItemViewController; /// Reference to the tabbar. -@property (weak, nonatomic) UIView *tabBar; +@property (nullable, weak, nonatomic) UIView *tabBar; // Convenience getter + (nullable instancetype)mainSplitViewController; @@ -154,4 +154,7 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { /// Adds any tabbar at the bottom of the split view. - (void)addTabBar:(nonnull UIView *)tabBar; +/// Updates if the tab bar is showing or not. +- (void)updateTabBarShowing:(BOOL)showing; + @end diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index b46bb184..149000c0 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -781,16 +781,26 @@ CGFloat const PanelAnimationDuration = 0.2; - (void)addTabBar:(nonnull UIView *)tabBar { [self.view insertSubview:tabBar atIndex:0]; + self.tabBar = tabBar; [tabBar.topAnchor constraintEqualToAnchor:self.mainView.bottomAnchor].active = YES; [NSLayoutConstraint constraintWithItem:tabBar attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.mainView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0].active = YES; [NSLayoutConstraint constraintWithItem:tabBar attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.mainView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0].active = YES; - + [self updateTabBarShowing:YES]; +} + +- (void)updateTabBarShowing:(BOOL)showing { + self.tabBar.hidden = !showing; self.bottomConstraint.active = NO; - NSLayoutConstraint *bottom = [self.view.safeAreaLayoutGuide.bottomAnchor constraintEqualToAnchor:tabBar.bottomAnchor]; - bottom.active = YES; - self.bottomConstraint = bottom; - - self.tabBar = tabBar; + if (showing && self.tabBar) { + NSLayoutConstraint *bottom = [self.view.safeAreaLayoutGuide.bottomAnchor constraintEqualToAnchor:self.tabBar.bottomAnchor]; + bottom.active = YES; + self.bottomConstraint = bottom; + } else { + NSLayoutConstraint *bottom = [self.view.bottomAnchor constraintEqualToAnchor:self.bottomProgressBar.bottomAnchor]; + bottom.active = YES; + self.bottomConstraint = bottom; + } + [self.view layoutIfNeeded]; } #pragma mark - Bottom Progress Bar @@ -873,9 +883,7 @@ CGFloat const PanelAnimationDuration = 0.2; if (tabs) { [self addTabBar:tabs]; } else { - NSLayoutConstraint *bottom = [self.view.bottomAnchor constraintEqualToAnchor:progressView.bottomAnchor]; - bottom.active = YES; - self.bottomConstraint = bottom; + [self updateTabBarShowing:NO]; } // Cover View From e3edbef32c5a77ab95e2135084c9ceff8e9076c6 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Tue, 2 Jun 2020 13:11:26 +0530 Subject: [PATCH 16/44] Fix for defect CXTDT-83977: rightLabel not aligned with headline. --- ...eftVariableIconWithRightCaretBodyText.swift | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift index d05fea10..e508c8f4 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift @@ -14,15 +14,17 @@ import Foundation public let leftImage = LoadImageView() public let headlineBody = HeadlineBody() public let rightLabel = Label.createLabelRegularBodySmall(true) + public let rightLabelStackItem: StackItem public var stack: Stack //----------------------------------------------------- // MARK: - Initializers //----------------------------------------------------- public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - stack = Stack.createStack(with: [(view: leftImage, model: StackItemModel(horizontalAlignment: .fill)), - (view: headlineBody, model: StackItemModel(horizontalAlignment: .leading)), - (view: rightLabel, model: StackItemModel(horizontalAlignment: .fill, verticalAlignment: .leading))], axis: .horizontal) + rightLabelStackItem = StackItem(andContain: rightLabel) + let stackItems = [StackItem(andContain: leftImage), StackItem(andContain: headlineBody), rightLabelStackItem] + let stackModel = StackModel(molecules: [StackItemModel(horizontalAlignment: .fill), StackItemModel(horizontalAlignment: .fill), StackItemModel(horizontalAlignment: .fill)], axis: .horizontal) + stack = Stack(with: stackModel, stackItems: stackItems) super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -30,6 +32,16 @@ import Foundation fatalError("init(coder:) has not been implemented") } + open override func alignAccessoryToHero() -> CGPoint? { + // Ensures that the right label is centered vertically with headline. + let heroCenter = super.alignAccessoryToHero() + if let heroCenter = heroCenter { + let convertedPoint = stack.convert(heroCenter, from: self) + rightLabelStackItem.containerHelper.alignCenterVerticalConstraint?.constant = convertedPoint.y - stack.bounds.midY + } + return heroCenter + } + //----------------------------------------------------- // MARK: - View Lifecycle //------------------------------------------------------- From 0708b6eec0c504d93a1e460311a1070f107231c2 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 2 Jun 2020 10:59:40 -0400 Subject: [PATCH 17/44] Add line. --- .../Molecules/HorizontalCombinationViews/TabBar.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift index 9d5ab9a5..e9f6670c 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift @@ -12,6 +12,7 @@ import Foundation public var model: TabBarModel public var delegateObject: MVMCoreUIDelegateObject? + public let line = Line() required public init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { guard let model = model as? TabBarModel else { @@ -19,8 +20,11 @@ import Foundation } self.model = model super.init(frame: .zero) - translatesAutoresizingMaskIntoConstraints = false + delegate = self + translatesAutoresizingMaskIntoConstraints = false + line.addLine(to: self, edge: .top, useMargin: false) + line.backgroundColor = .mvmCoolGray3 set(with: model, delegateObject, additionalData) } From 67f2ee7aacf0dc3824587988067beb3ae8a2b6af Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 2 Jun 2020 11:16:49 -0400 Subject: [PATCH 18/44] remove images from core ui --- .../Account.imageset/Account@1x.png | Bin 978 -> 0 bytes .../Account.imageset/Account@2x.png | Bin 2136 -> 0 bytes .../Account.imageset/Account@3x.png | Bin 3355 -> 0 bytes .../Account.imageset/Contents.json | 23 ------------------ .../Media.xcassets/Bag.imageset/Bag@1x.png | Bin 394 -> 0 bytes .../Media.xcassets/Bag.imageset/Bag@2x.png | Bin 651 -> 0 bytes .../Media.xcassets/Bag.imageset/Bag@3x.png | Bin 897 -> 0 bytes .../Media.xcassets/Bag.imageset/Contents.json | 23 ------------------ .../Home.imageset/Contents.json | 23 ------------------ .../Home.imageset/Home@1.5x.png | Bin 450 -> 0 bytes .../Media.xcassets/Home.imageset/Home@1x.png | Bin 362 -> 0 bytes .../Media.xcassets/Home.imageset/Home@3x.png | Bin 919 -> 0 bytes .../More.imageset/Contents.json | 23 ------------------ .../Media.xcassets/More.imageset/More@1x.png | Bin 134 -> 0 bytes .../Media.xcassets/More.imageset/More@2x.png | Bin 160 -> 0 bytes .../Media.xcassets/More.imageset/More@3x.png | Bin 233 -> 0 bytes .../Verizon Up.imageset/Contents.json | 23 ------------------ .../Verizon Up.imageset/Verizon Up@1x.png | Bin 503 -> 0 bytes .../Verizon Up.imageset/Verizon Up@2x.png | Bin 915 -> 0 bytes .../Verizon Up.imageset/Verizon Up@3x.png | Bin 1409 -> 0 bytes 20 files changed, 115 deletions(-) delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Account@1x.png delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Account@2x.png delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Account@3x.png delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Contents.json delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Bag@1x.png delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Bag@2x.png delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Bag@3x.png delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Contents.json delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Contents.json delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Home@1.5x.png delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Home@1x.png delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Home@3x.png delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/More.imageset/Contents.json delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/More.imageset/More@1x.png delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/More.imageset/More@2x.png delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/More.imageset/More@3x.png delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Contents.json delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Verizon Up@1x.png delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Verizon Up@2x.png delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Verizon Up@3x.png diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Account@1x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Account@1x.png deleted file mode 100644 index a77098c25cd82181cce01d235dd115837baf73bf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 978 zcmV;@11Px&j7da6R7efAmRYDxQ5eTv(@jZai0c8@REFG)g%px9L@6G;;FiLJ+Fga z+0=@#aWD%;Ko6*b-|#%*8tq}Y0>9v&)Q-_>;1!r8;KbVMi)_L70^16xgul{UMm+^5 z{07HhF;qia2r@xGSPCcMJ2>VE%!JHpN#sUwuurxNOqNvx2|NH{{JJayO}alC^qO{3 zmO%+IGq5*+H?SiireF?F`T$Gcg0;NU4bwE33SG+G1%9ft1%nD8!ag>CQohY$~OOu(@nDN0_ z(hlMJC)8nqw9Sx1(6^M*S#m!KEan0Pj*L-{85w`*i| zWs($pAvP|~BUQ~Z@$g(XU#(HMthpIk#*}#)4Z#;;8$FG^(@{6Kf>xzVReTIKhUR;H zXug2k!hWgTub<%~bT4%lU3aE$9bDJu775Gbb&^)&aFDUJ;Jd1ZCGZyXErm4s0M88a zDY7KC`ZvK3FiA1)i1knbX)^Is1MkBCaH*X%O`{3$l=D5gJ#N4*xD9FQNPw$z&A_wZ z-TT+}zhxnt>yTBQ%T7B5vdA%2U=@#o?vQ1P2`l8t;f*WY(r3E+RUxe=yn0QMwaZOxnxpLVZbP#GFtE}EoNG@;c zla@|A4MTX>-hfrQ5{7|CUr;AHo=B_UJQyn$QsO(s*R1@WS_X9xCJe2AgB~2=I<(%b zTc+8ftRNt(T<+Q6(^Y}{++@!qJO&SgpE#-d1I(!R diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Account@2x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Account@2x.png deleted file mode 100644 index 78ddbb80d0f55c0977cf64f680ef81a3c28a5549..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2136 zcmV-e2&eanP)Px-5=lfsRA>d&n0csGRTPJ{)D)+ja!6B3d}?C#D5uh>#Hc`;{t$}{lLRA(P$Gv6 z|4~Cq(}>cX(4w#`6EP(#v~r-*(!?+`F{jEjOLNHjez&_Ht97Sy&OPs`3%z>-Rs!tl>x<6DxMV8i-jkBDkJeFlY<&G?yC_jV0;JlZ1L^v8gh12j)LQY_} z21Y@1IPYX25v_#3A?YLw*`37a66g)*Tm})rdMFgE?LURyF4zL=K&#+u_z}*4)h$$C zjb0z9ap}N_y6c4kQ~$Rx3+{t1PzMT0JuY;Ip)ebCV+#4!-j_}bs1doFQFPek3+Mp- zQ$WF&E7#-TMfeT!jdhTI9g5W|;w3nz6sC}(w1g8oCZ3z{kYmDBOrBYfX6o= z-+(jeZ>X6F=z{^j%bj-@MECxpJMB6OggJg!%&Tlh%GuBs!qHvyq8B{b$sJ z;%S%%AAp|5Yw#p=hNLnHLm%g`xX$$I@u#t#Y!Vra(Kq0O@@*~A0Z9hHX0h|H6TNR# zUmZ~N?^*5HxO+nf$TIK~E7hKhjS`VKQXl1wV155YJJKQMGbo+LkqprbqC-V?HUL}q ztH)kbU1?_{h$HP#)+DX3>7^VDat3;_$9?taFv)j()M26j*-3S*&IVxXJ!g0qv4$04pP#lVjLb|D7?oubmk zxEYl8zy8bG0f*C$D$k&3ZGWa6cRO{(=Ctvn?b97{WFQ}l)iNB zI8AG-1FdBo zk7Jo&l> zwEy@1EMcGTvL0gaxlRhdnvTutC{xB`9|j1e^5kNHU&{4GdF&phuUz>B2O*Bkmdm*V zWsaa_sV^E~kWlJSn+V$5%7m1KX}>DTu{S;F&!;~P*^QInGqZw~$%KwgX^emmJ+aS? z-{3!Lxg1+19BIgYoP=?e!PU|`E_CcsM@piA=R)uurPRA~D(LNzhRDwu2xEUGr$3mE zlj=xW`r>a5oP{v3FBQ~#&;!yG9in!uwRPy&2c1At51K*J7rlIV(bB#Zv~TZ%ifmms zKx1!%6`*~bw&+unm3^A<4(Mlk+fh$*!ojun(wxw!p;B|PvO{ZJ6Si`bZCv1WKbOp0 zwcPAFf9C?9qz&JHy6vK`g7ra5SfxbYvRZ%+lC-2fj&vY(geK4ww1{#01s#p()hF+2cC{sUuHB}1v%u@+Wc zp`!1__TtO-VvPE2=xR%7by$B%>PmUw=GKO5xpULj9gUlEo#JL^MrEz_ki3AD`afPQcz+zAiC zWKcS(v&7qnwz9BSp%Ijlw@?UnDyQc&(9*F=f6~^33W)+g0M;hdbw{Uye1=1VYDrOE za5KyT9cICwEqBu22MS47F6ib2o72=g7E;#I35qITDxmlj{b!x7^!LDU2q!+(#L^hc zC&1?VA+}TW4=dnVDQeJDIj?|TrdxN;Pekcp5Irs3ed|zl?f(hT0MZuy^V0URPc4i; z&J8w_cDSbU1YGHKa+0RM(T;?E3W}B5$q!C~Kd1$F{wJ>rJ4h zr7Z(~2R0U8R|cmi9!o}`?Hz^o7hKccI#;3;@p}mI*iw64ue(Gt11sxH^&_A^*5_LE z`pLHn$CMM8KFDeR`bn>&?}~C9muY)7_FKWnwV+JD8FTGZeUb3a57T#VMx$nb9%Z=W z;N#I`^~EL?(ffBA_(9a351pX8MNicy6&hcAwyb4bEbw7m)E^5!aiwo_p);f{`Xiux z-6uqfL8o!z0}9(n(ig3K34j97-@@17erO6wr4@z`!ZOG=QH`bdZ0uJLHi<<0dOB!= z{%MD{p88rC3j?7Cw1nCaL|a8Ceowd^Cc#E1G)ehZx;POcCl%tJJ?Gt)`A}-bn)@8Uk;^AxJuDt$>9v z7;?T;(3e>3eoE}5fT4VA-&R6J7A61svmvw%{(xh!4|E8LO`u%4TI65a>d;WKYt$S7 O0000Px>)k#D_RCodHoPV%YRTamhFn$vX1Ue#tC}L)6Xn`gOo#$cC+UK5g?>^^V zi0{nzopaV+d#$zi*=O&y_eEQLq_)tCaL#~zW9-F!N7y08L)^a`<4*3^!8I|i<^CY7 z3ACtk6fN=J9}a2aK(1|I2<*bhbFdE9!{zY5@c#+}XzeVx1FG>wa1(y+f@i{`8Yj@Y zpFn-mMRaVEk5`CcB5Vzh8g!#2Q=#V6q{dgHYzr~n2;0M4k>?!!2_l~izXQu1IqH0U z^6HRi@!P}wN1+x+b&#$-pk8RX&=htLycg~(*GM($jlropC(9^RhM-Sc4ITwQ3){l9 z(2KnQehbcot6>)Z(p8fAWnI_;D&{OVQYZy*I>tLx4e-fQ`)e2toaYKn9w^Kd==9%4Kz9O`y_D`YK zi=+^WrG%b7$C7kE}rW+$E z=FfS!c`Kp43n>eA(%9T08BEG9{!Y0Ljq-**ZN1Fyu!xka4}R7|-^hNHvY<%Hlhw&t zw#r!o(>DB8s6|Sn>ky0@eSmvyD(c`3us6&DrM_hO4g&4?qQ<#b%~hdCvPP=TE6O=e zT}-`8VQ3_+P5W@BGnR@V2fhqL3t#9tS-ZxhDaw7(zUODK^Jy3oN!eBdjyhH1>{%*X zjZq30I=lE0HV=CISuvE7?ZMUv7!p@u%;#4phGk(4wR}cH=E?fqaCU+(UkqvFn$su2 zkeG!r%eMxJMtvseRBa2i49?4BskE|2g5@VJ+mB8?ybn%>x5M8-&B^fvGF~Ts|9$jA zp*4nl)7wjwWy*%8Qz0H`biW;W7Z?f?F%;RhuG)o-he`9FvVxnTekHMNNTwI{B^V0I zhLrVK{;o;uq#KHRJw_&^HIhQ_Y;@ECRT39;+Je%xkin89g+PTTE4~^`iF`1#(n8r$n)eO z_^|?%OgVI=xB~;0eZ9nV%k{sy8XC9b~U2UfC|WkIwTKh+v=hxg6^&` z!1L!lHmn#ts;R{~Wcr(--49tSb#z~&P$C`q<$+~}QDq#%4SA)a%RL6H7(A+(#8#iF zk57}8TcA7K^{k`7JRql*KV=>vQ#{ShZyUZeKWn(vf?Z!0LX}`pMiaFox;`cA+l_+9RFE^YJ}7`F z827rDvZ=5WEQKB@%!UV{YbSc1PFWGqJRSLru8nD*j`JcxbbYXhi148Ut5t^oC=Olq zDLw+Ph67+vcq-I9{9PC=Zt*(qy>vbXi@?h`as4-@lkXb^c^ta<8rg>e>vMC1E%#ZC zO!HOv;>#*mn(D^7M4zulj0>%vMM1xKoDVe;LPH1t7r~vO4JX*M`tDs{N4HBbltzLet@G@Cvx6QezqGTYc9!nE!zxcc?GUXgs8Pe~c|KVsc}&o)1xP4(tu9 z1uMN%OpX6f3pZ%xq1A>y`5CYQy79TsI&_}`&w|y2cA{=-W` z@3>x`_s?ToydLU=QKR%kcoIASwSc|}l}_colf^|UC>ye{ULC#KDnZrV}(`^Sber1#Re&B$D};doy4u9 zOz9tk-2<%BFO-G_f#aCc>!B--0XQ3aB+l8@lB|yvs~Ot#mHX#`cRU=iJnT! zke3t8In+}&5D%c#y++%g;3W7}*c&Ph^+9vJGLuno3VaH_2TS>hm)D`+17?M$plvX2 zE4m+?WUMuXTRauVBvo|E^iuR`rky4OPxL*>Z^>m$9Mk#dTH9J zMg2b>o0lOk2~FU>QSh@8wLe9CxkB+8=Bs@Z)Rexzx zCAaKmj}h&-w7Icx9>O=F;FbM64Xu7rrqioQFY{%N$EX~QhWfOWF<6czThXM$ zrKX{2&o@fdju&A&csum9^%ly?MptV3w#r&@*Fc}+g_LPGc%+~Yfv$(X_9$!7#>pyQ zj66-If|?(LC^`Tw2R@lTueN@ZHCxi1$n+KZ+GWXiqF?ru;r7I&49;IdSD)FD3QdRq zf>x(mvJoL0szu<*6wVva=@!y)m24@6-3_gdjmxIx5uZls3niRiormKp*_>LUtx6Ph z)Q}65L#~4Hw;I3K*~T@wcrMPUzTP`wyj|}7UnsA5@hjD&Q&8AgB9Pxu-lmkH8Z1|q zH6OYi8-G@+r(=pjpao+kj0fP}YrB16A<=|!awTTALbo09XN}~-Iyq{Vwy?^TsW~TA=uLp_i|@IL(g)$}VzS z_}svfo^POVA9P27`}{gO*TD|3T2T5q8S3S`@ww01j0DY-u~#uJz(NCbgSDP_p?5F* z3@ic~jTgb$P??bxlPg<{UN2aa=tNXAq2^{caNn~|$8LlDVaQ)vT4QezoB^}!^fZ;| zfGFrRm)E?bPMZaF&4N8BFM?WRUxVwQ4tlgpOM>!y9SVv1N;G=UhgmyIyWeYJ13Y4& z#9y124bV55)5B!5@cdGL*bJUthpOa4d}SK?2Zv)}dssN~S`4!^M8Coe zhL^x0upiXuuLS$4ta-N%*2CwavWcpp7CPE(d@BT}!M;uG#Z|jFjl>R3Jj7MMx{I0$ l-hs+a)-+KYqXV#J@ITm7{O|ioBKQCR002ovPDHLkV1nioW%vL9 diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Contents.json b/MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Contents.json deleted file mode 100644 index dd3bd4a8..00000000 --- a/MVMCoreUI/SupportingFiles/Media.xcassets/Account.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Account@1x.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "Account@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "Account@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Bag@1x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Bag@1x.png deleted file mode 100644 index 08d4e5bd78af30805965e596b3b31151508919a5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 394 zcmV;50d@X~P)Px$L`g(JR7eeDV89QIfYR%L_%RUwN5Y?g?1Mm@3dCfA6rir(K>QDgZvgQgBzzLc z{szP#3pW8V6A%*(G=M6<1Mw3eHpih$2q+FR7-T^S4mDVXd!U*;vC1L@d4SAkK>QFP zM3{8|s08G47Q#vymI2j(TrY~Q7FSpa0~LM*;y>sbu<+kP#Xx#c04~E(6p_mTdD{z! z&Cm=G1M<0nxB*QZ8yBWG2PpXlNx@eTdnynkr(tTbUm-_WKhTm(AlrbT1&DcpI3L6z z0Ahgh&OlrR#LuB>XF_SX%R#{d1DAn}7cdS1dNNQRS)u8Bsg*mdzQ52BD0lS>0NpaM0tkE(WETh4KH3YBHq)$07*qoM6N<$f?T?jf&c&j diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Bag@2x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Bag@2x.png deleted file mode 100644 index 640cf1ecf7561cd0a46da31ec12a4c873b227788..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 651 zcmV;60(AX}P)Px%MM*?KRA>e5SUXDtK@g7O0}H_i2wI4R;Hy&<5$r6)LbR~7(Z-+QPq48Nu@l7F zN)T)XZA6nsEG&E=7FsBZMEyn*ZgSjkx9&~i!3=!K?9A-9lW+Gfm*jGOR)^`cz&20- zo`G)xMZ_O~6JQ+}1ZrZFSoIW;8jXw72iXBSfvVXGR{8+qnoE+u2G5Xd=d{(XwuA}$ z0H6Dg@eyzdyZ}*Fk6;%t4UC2gZZRGQ?nCj^hJ9dq1-O#ba4+Cub10@}InS{Rfott< zXt529x$-W2?I@-l;?2*y5G1YbK;b7_=mLIo(#b;I7~-7sP^j|?FJm@WXU2;yn7qY! z>4I+!QnE)EOi~+Wg>=r-I+F*Cw+Vhf8;h<>5ww+f>5VS@SaWIoEtc(X1z(sZ{lFF( z?Tm}kC?!mBC1FKcQ(TlrDPf8$2`kc?;-WN42~%82SdrEg7o|~3nBq#pinOM(O>t2gr9@^GkNSUn0V0hk3FSk}|NPHI lHQobu!oRl69+k{C{sYaQea`QpFRK6m002ovPDHLkV1khQAvXX3 diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Bag@3x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Bag@3x.png deleted file mode 100644 index f621197f200f29ac556e58dd3fe2f024f20714d3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 897 zcmeAS@N?(olHy`uVBq!ia0vp^u0R~c!3HGX@y<>MQjEnx?oJHr&dI!FU|_cPba4!+ zV0=6K>}uackz?m4x~Ls;=!kCn!T!WJ$w5-GYv)Q%i_-C^S=?<|G!!Nmie~#Z=ChU*vvk!-Aj2dRb@^M zQM1dqr2TSfiT^G=+i7ZMeJekyUs^v)wEEaRVbSQ&x6CW^Bwp4{R4(eRl?iN>U;2e* zmQ`QO#NwRCJG6dlnzAb7-#;O_GrO}+clV#0DeZN4CQf_$=BM93-b{s~zMuDos6A@i z6L?G8)qTxGjeRHYsNY?FP;bvwuU}D%w10a3i_B~dF-__>4tnFcb5YxhRGmkYRxMDP zf4aZ_@vh|AW;JSo=T$xp`D{>t-rZ}$tr`J_~W9dgHw>xicb)7J6NePkmIUNguJGAcp!R%X$=7dDAv|8n)IW^^ynj}|@p|hcg0>d=xqX7*J5ykS+>ZWF_ zkN0IOeC8Cy>Z|Ez(x8HMV=i=js|Gl~BVE?_RPv_C~@>>7K)%hB2Oe_bA zmNQJ*=`SxatCDBqWHz@w!Bw?YPb}j6ytmpmdwx4-y=PhDmTTRg^q%X^_`3L7#Wq|0 zt_6QCoO!tC=1u0Rvd>G8?0VyObXF{~6`9s~S`RO)WL^o=WQ&?>rz8<}tI$a7xaG3vwjXY@>&;sz!6m?O zdM-qB*Fpxy4RN Z@3qrEOP=WM+zQN744$rjF6*2UngGETmxKTS diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Contents.json b/MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Contents.json deleted file mode 100644 index ef86d034..00000000 --- a/MVMCoreUI/SupportingFiles/Media.xcassets/Bag.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Bag@1x.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "Bag@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "Bag@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Contents.json b/MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Contents.json deleted file mode 100644 index 02784f80..00000000 --- a/MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Home@1x.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "Home@1.5x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "Home@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Home@1.5x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Home@1.5x.png deleted file mode 100644 index 17dc8d9655ead06d4698b1ad0cd9c529c27296ae..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 450 zcmV;z0X_bSP)Px$d`Uz>RA>e5m_2U7KoEru0;QoxzC{i|>h$U9attm)0d2Z;Kt+`tAe?|AH%O46 zgZEG@tyW&!S-j&}v?D$FZ|&J{W>(s9mW8(oTx_6GcvoRP5abs+LmyDIKqd%bq6I1g zi4y1uStv@207q#3mze_S6W8iX&dvxyo}nJJfC?BMRj(lz2=5ThdbO0<0duPCSj#}T*k2UF z{9sPbj&*>C56~1UY>$&2L>P_6@_L2dp`kIsoG@GCMl7cUTG^BB+c#pqPB2=tmok$w zBM^a9W&%O>a*;CQ6*hsFQf35#?Byb5#w%Px$BuPX;R9Fe^l{*RoK@5g{T|n>*9>mH*Y-|*4+g1sm3 z^#^t&#&Otn9$IYRXXlmVBQs=+IXf%BeFjyatzD?^y$NCg-Ju&4LBWkf5XetpIK%}I z9cU67Mnbd!pez`S2_hIw5(w`wX&}78d;{Se#s8b%7 diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Home@3x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/Home.imageset/Home@3x.png deleted file mode 100644 index 8d67c8010748b995eba018bbf483971e888bdda9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 919 zcmeAS@N?(olHy`uVBq!ia0vp^X+Rvs!3HF~(v`OWDaPU;cPEB*=VV?oFfa#tx;TbZ zFuuKQndENg4Tb)Tzy`fr+Me1EZ`?|5hIG3)5`(ilJ4@P``mIe)i)Jv^;I zr)8=9ZVf)=IZIvF)Qfi&h_y*N37&JZkQ8}1p-=!w6f9f7k)Ae(=T!b|MTK2uf3;#I zG@C!&th%@TtCvOV<@c7cVo&c~{kT0x+|Pf;(s^!yi`Ew?bxM9)sbSa!WHkL=2w^Z) zYfh1HwU~H>u{smNXsOi$Ggvm9?-g3ip+3pujSfWSz&W?hz!qW8k~iK9k7yj~R4Mzm zG%!izp^MPA^{lFHLg%;wTQ(<6Syp)M+b27op9pwalS`y4yOd{i+JB%^M9H4 z{+m~SmplEI+iS7gAaV-(wWrzf>bC#mnf{4>Z{L>gRK&=R0MK(jORn|MA2?pRMc5;!T_u=PsYo zd~B;0yjm)WsY$V|cZ(3uB(aTQ21hnb3~O?{q;!p|O~UMwmw`vrk*I?Lhuxw$**v== zv?Y>mcxWF~$P~@-IRFzQCOe#QjEnx?oJHr&dIz4avVHe978Mw zlT#8BHn1nHVsu;J`F~}a)CC2#EGe_BYYM!L2j}NF=q<_elU!nGxMU7%*Ob3kN(`@F hRy=W_Dr=VjgX|QRqkFbYyaF_f!PC{xWt~$(6982hD)ayV diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/More.imageset/More@2x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/More.imageset/More@2x.png deleted file mode 100644 index 158c6636bd8a70a0116d6999a66312cd0dcd1a59..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 160 zcmeAS@N?(olHy`uVBq!ia0vp^8bGYV!3HFM+f;}FDaPU;cPEB*=VV?2IZ>W2jv*18 zZ>JsPWKiHavZ~v9*DXmtMUOw?Nm?_sen?KwpC~C^Fqu(Za@|dqCHWq9ycrJ6Qa|oC zm`={SG0T(p(PaC*3qDI-Xkat>aD(BWy5aUq;t6?6**<<|zh2BTdFQN2{Xkn7JYD@< J);T3K0RT%MHdX)t diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/More.imageset/More@3x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/More.imageset/More@3x.png deleted file mode 100644 index 54de11dc7af5b0cdc2287bbebebe1812b8d65e3e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 233 zcmeAS@N?(olHy`uVBq!ia0vp^Hb88~!3HE}r~eWGQjEnx?oJHr&dIz4au$2KIEG}f zzP(|{)nFjN;vo9}>E)VP|9pHkmvNMB@0sh)^iC(@j!ESv)@SPXCdz)CyN-3=y~S^~ zt6JYPpL-yF@|w=J&A+C!F)%W*a0n9hZ)frbi`uSuxacTvec5mC_lK9uu2C;w{>;ys UTrk_X9OzsIPgg&ebxsLQ0O+GqjQ{`u diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Contents.json b/MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Contents.json deleted file mode 100644 index 11c37b59..00000000 --- a/MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Verizon Up@1x.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "Verizon Up@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "Verizon Up@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Verizon Up@1x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Verizon Up@1x.png deleted file mode 100644 index aa034686f4d37e854d6c3fa1074d2e00a6f2c840..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 503 zcmVPx$u}MThR7ef&RnIF0Q5c;O3s#iaDN9O;va`0dRF?svT!e)j2$n2klM=tgx0eruTBVn2_n}s&qa9$Vugo)#B z3VD|NNaSX{| zeLLHCg>Rt9@%LW^y%HS^1#G8$G7MPcq7=mDwtk9Ipva_&osCD%xKEVO;OPl)dy@UZ zOYoKCf|@;do~vrwPO1^D>)xHc|L(o-b86q&-Yz^B_qD$I?fJd6;DtARo*Pckepl?!l{>R1oFf9J6@I)?b$69HxMfGTarw=)}xGrf{JB=tO%<|ZEDv7Ww6rESK;Nh+7nq-L-)__?1g2)I18O6KX>RVJsG zPFc;nuK(9ewe3@jqJqPZW=^TQz`L!XGC`(-Igdf|xnYL)mE-%TWb!eT)Gs~1{Y--X zoK35P-tRx26wg?G^w8>W_cy*}vom_apy1tB%l7%Jt!uNSu2k=lGLagF^v3NXZx>$G zim=_`9MU!?_~o&%s*6n1cGj`}KIpYU@DBSjpSBxmlQLgb#$EbqBD~?pn%3P*KTf~! zp5e3QM&@@jo=x{UYkc_Af{&t{A^c&t>e<{~43~8OQfc;H^Gvef(F3veY%#wTa_shZ z4_d!m#QNu!VerlNT&3zQ)1OFwC|E!9PpRDFjK`1mTl|?@vYbgSTQYG~tM{TbOPQGI z@2uPRPd+EK!N$cWGDBb!!)qQr-_UIf1I3Q>ioFxQQ_OvT(kY=2+}{1aA6#QT`O2t3 zw!+>q)0lM*`!Cf!ZNJJAPWg7sSDP7feiOg_!r)^6ISl2BnH#2j%li}7$ey4ygFC0w zlJmXpw!TSLmOak1Y{TNdY(7;Xb!zrBoi(|A(;uoHzL)e`XXWH}i#Z+zRsFT;P5ozU z1TTH-xlsE)=;j(>yQ*moOaI3v2v0arGVx42EB68A3+V^8&VTgH{oTiM&Iy;MICd~6 zSpLY6x_oW(ox`i%7i%z82ApNQe;{~4Q`UlV#`u>@4=Nc5pJDqHYQpeD`4M}D_btu{ z-aGwDFSeYR_IU4G6+G_*tX=uyzfnTv zWG=mra(w%qG_vzQ mU;XW_>$!D~UYILe9kWG6tN(e^MljKR~@&t;ucLK6T`ajHcC diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Verizon Up@3x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/Verizon Up.imageset/Verizon Up@3x.png deleted file mode 100644 index 072a2758e8af7fcc5a3a6e1c6ab408b6c8de84b3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1409 zcmV-{1%CR8P)Px)J4r-ARCodHolR^OMHt6hf*?vL6cddCDRRKZ)Sd`xOf<+>f(5T$2*zGe(gQcI zUJWFCc+qH6YmA98UKGMd_(-Zk(uUTQkaB=G1&kW2CQ39amH$6slV$eZnP+!qr|tHc z?BIGy5*IwWX!ye@Iic1jZIr8(*U*1Qc{aqT-{1t{89cGu$iNli3kig;W?^PhlriOlY;hVD2kw zQ3M4o!sPFyp#2$&A}DAPCVwXd?axpYK|zZ!`8z3Se}~F! zP72zep(uia7Gd&tQqcYkMG+LV2$R2)g7#-9ilCrHnEag-v_C^p1O+X^<2^vgf%klzDshE_w5 zKtDl~&~fNfr~y@;%$H}FFY^LTvp7lFw~njW0DI!w>}d99(BeOFudRo0JPJ))eA(6= z=n(WU6e7*57iii+>^tZ!sMSG_(`O$v0zKyNEp4vj9L-02=4rGh{OX>*Pm&)r1@Pcm;vwp}`hZ(!dyldV~+Wr$K{m=#IUx?F5 zFXWnw_roW>azWNF%~jA`Ex6LpaM%uAN;!Ux^Y@{X&{L^$^Rx#Aycs{5hO+s(P93}v zTc9-LgwYM0Y=$_(^AZOjeS)RBg62l#dkZCQfWENUX|ipg996UCx`O^7d#Ra{PckL< z7j)mB^~=>2^c4Y?YYrc7)q|zFf}Ru*`oZB7bmLM-(EkA7-wud0bLl5py$C|NU1kgD zMeeSOJs8WiPG&IfAZ_dM-{=%7#RAPIX}0vF%~-;=R#0b+!{=9ry^uK;=nhA(_?R?g zdPNZIC5O*thrN(FBxpWx&r5AEyqsfPh4S7UTiIeh9$jv!yco897CTLR%o;3(1U=>G z6(7Qz+g?5`<92w7qpoST&8_rZ263Idlo=!Onh!#c8s+IMza-D53w+NP`UXhV=T6Kv z?-BASGy+XRoe)8n>4RjoumiFA%g)=-5X3sqL2p7kAzL~HW5ec9)K=yq^V&EEgKKW& zNA~%9!lClig%-Xl(aPZxb*xoFP8|biNwR*mc4!tDzeFFt4&9HCpnpN<-Ywa|^QgyP zrlrX>NB|DNH!#BcIX}GM8Teo!~a$2uLAX4bM$V+a&58A<{Bt?5h`-S z%^11)(4hZAOFhsLi07{KF&sE&^SzId={kb(=csdnpuA}xL0rqTUL`5ymtoRDK2Yz2 z-h()@wn80HJH%}*p9OQO7=X9}NzxlQS(0RoBR|sVAvuM-u(|W)41pv zSs8_%qeG2~+Qm`Ok#4DiR?v|ML~2GybR^JKtfOOey&sKyV`=E7#Wo|RxeEFWXi;+} z>C_SFRw-x&9f?4sW^_a==tu-2HKQY1K}RAGsTm#73OW*jNX_VoR?v|ML~2Gyw1SRA zAW}0rq7`%`0+E{05v`yj5s1``j%WoPi9n=g__8414Kvde3L0ji=0yZL;bs1Fzp=a@ zXZiQ|n*L2bQB&%aA)s?~21zvq3c4DunWzdngQS`Q&e3Dlgx07j0uy%u1W?Mr7#WG% P00000NkvXXu0mjf61$WO From b66f569e773c618d3386f80d7a97f9245ea8e299 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 2 Jun 2020 15:38:27 -0400 Subject: [PATCH 19/44] fix to anchor --- .../SplitViewController/MVMCoreUISplitViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index 149000c0..1e04d987 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -782,7 +782,7 @@ CGFloat const PanelAnimationDuration = 0.2; - (void)addTabBar:(nonnull UIView *)tabBar { [self.view insertSubview:tabBar atIndex:0]; self.tabBar = tabBar; - [tabBar.topAnchor constraintEqualToAnchor:self.mainView.bottomAnchor].active = YES; + [tabBar.topAnchor constraintEqualToAnchor:self.bottomProgressBar.bottomAnchor].active = YES; [NSLayoutConstraint constraintWithItem:tabBar attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.mainView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0].active = YES; [NSLayoutConstraint constraintWithItem:tabBar attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.mainView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0].active = YES; [self updateTabBarShowing:YES]; From 05bf9cf5acb729565eb5c8c5a10c7d1d33048065 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 2 Jun 2020 15:50:14 -0400 Subject: [PATCH 20/44] set model as well --- .../Atomic/Molecules/HorizontalCombinationViews/TabBar.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift index e9f6670c..2216040d 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift @@ -82,6 +82,7 @@ import Foundation public func highlightTab(at index: Int) { MVMCoreDispatchUtility.performBlock(onMainThread: { guard let newSelectedItem = self.items?[index] else { return } + self.model.selectedTab = index self.selectedItem = newSelectedItem }) } @@ -89,6 +90,7 @@ import Foundation public func selectTab(at index: Int) { MVMCoreDispatchUtility.performBlock(onMainThread: { guard let newSelectedItem = self.items?[index] else { return } + self.model.selectedTab = index self.selectedItem = newSelectedItem self.tabBar(self, didSelect: newSelectedItem) }) From df980722fdd6c9f510cfed549bfdaff294c393a3 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 2 Jun 2020 15:53:56 -0400 Subject: [PATCH 21/44] move model update --- .../Atomic/Molecules/HorizontalCombinationViews/TabBar.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift index 2216040d..94e53790 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift @@ -75,6 +75,7 @@ import Foundation // MARK: - UITabBarDelegate public func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) { + self.model.selectedTab = item.tag Button.performButtonAction(with: model.tabs[item.tag].action, button: item, delegateObject: delegateObject, additionalData: nil) } @@ -90,7 +91,6 @@ import Foundation public func selectTab(at index: Int) { MVMCoreDispatchUtility.performBlock(onMainThread: { guard let newSelectedItem = self.items?[index] else { return } - self.model.selectedTab = index self.selectedItem = newSelectedItem self.tabBar(self, didSelect: newSelectedItem) }) From 0613fd132a87f608d39e4ea3487e016f29972408 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 3 Jun 2020 13:32:46 -0400 Subject: [PATCH 22/44] allow server override --- MVMCoreUI/Atomic/Templates/MoleculeStackTemplate.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Templates/MoleculeStackTemplate.swift b/MVMCoreUI/Atomic/Templates/MoleculeStackTemplate.swift index 90096145..41619142 100644 --- a/MVMCoreUI/Atomic/Templates/MoleculeStackTemplate.swift +++ b/MVMCoreUI/Atomic/Templates/MoleculeStackTemplate.swift @@ -57,7 +57,9 @@ open class MoleculeStackTemplate: ThreeLayerViewController, TemplateProtocol { let stack = MoleculeStackView(frame: .zero) moleculeStackModel.useStackSpacingBeforeFirstItem = true - moleculeStackModel.useHorizontalMargins = true + if moleculeStackModel.useHorizontalMargins == nil { + moleculeStackModel.useHorizontalMargins = true + } stack.set(with: moleculeStackModel, delegateObject() as? MVMCoreUIDelegateObject, nil) return stack } From 57d7a5f7ccff9e091d928972162e16ead2c7face Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 4 Jun 2020 11:46:37 -0400 Subject: [PATCH 23/44] Add action to collection cells make paging configurable for carousel. add insets to carousel use button helper function for collection and table cell. --- .../CarouselIndicatorModel.swift | 4 +- .../Items/MoleculeCollectionItemModel.swift | 10 + MVMCoreUI/Atomic/Organisms/Carousel.swift | 187 ++++++++++-------- .../Atomic/Organisms/CarouselModel.swift | 44 +++-- .../CarouselPagingModelProtocol.swift | 2 +- .../Atomic/Templates/CollectionTemplate.swift | 2 +- .../BaseClasses/CollectionViewCell.swift | 32 ++- .../CollectionItemModelProtocol.swift | 10 +- MVMCoreUI/BaseClasses/TableViewCell.swift | 8 +- .../ThreeLayerCollectionViewController.swift | 4 + 10 files changed, 182 insertions(+), 121 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/CarouselIndicatorModel.swift b/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/CarouselIndicatorModel.swift index 359fe98a..8bf3fa19 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/CarouselIndicatorModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/CarouselIndicatorModel.swift @@ -33,7 +33,7 @@ open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelPro public var disabledIndicatorColor: Color = Color(uiColor: .mvmCoolGray3) public var indicatorColor: Color = Color(uiColor: .mvmBlack) public var indicatorColor_inverted: Color = Color(uiColor: .mvmWhite) - public var position: Float? + public var position: CGFloat? /// Allows sendActions() to trigger even if index is already at min/max index. public var alwaysSendAction = false @@ -79,7 +79,7 @@ open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelPro self.inverted = inverted } - if let position = try typeContainer.decodeIfPresent(Float.self, forKey: .position) { + if let position = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .position) { self.position = position } diff --git a/MVMCoreUI/Atomic/Molecules/Items/MoleculeCollectionItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/MoleculeCollectionItemModel.swift index 4f203813..645d16b1 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/MoleculeCollectionItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/MoleculeCollectionItemModel.swift @@ -13,6 +13,12 @@ import Foundation open override class var identifier: String { return "collectionItem" } + + public var action: ActionModelProtocol? + + private enum CodingKeys: String, CodingKey { + case action + } /// Defaults to set public override func setDefaults() { @@ -35,10 +41,14 @@ import Foundation } required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + action = try typeContainer.decodeModelIfPresent(codingKey: .action) try super.init(from: decoder) } public override func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeModelIfPresent(action, forKey: .action) try super.encode(to: encoder) } } diff --git a/MVMCoreUI/Atomic/Organisms/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel.swift index 9fa72b5d..4a55c425 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel.swift @@ -19,8 +19,14 @@ public protocol CarouselPageControlProtocol { open class Carousel: View { - public let collectionView = CollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) - + public let collectionView: CollectionView = { + let layout = UICollectionViewFlowLayout() + layout.scrollDirection = .horizontal + layout.minimumInteritemSpacing = 0 + layout.minimumLineSpacing = 0 + return CollectionView(frame: .zero, collectionViewLayout: layout) + }() + /// The current index of the collection view. Includes dummy cells when looping. public var currentIndex = 0 @@ -36,13 +42,13 @@ open class Carousel: View { open var numberOfPages = 0 /// The models for the molecules. - var molecules: [MoleculeModelProtocol & CarouselItemModelProtocol]? + public var molecules: [MoleculeModelProtocol & CarouselItemModelProtocol]? /// The horizontal alignment of the cell in the collection view. Only noticeable if the itemWidthPercent is less than 100%. public var itemAlignment = UICollectionView.ScrollPosition.left /// From 0-1. The item width as a percent of the carousel width. - public var itemWidthPercent: Float = 1 + public var itemWidthPercent: CGFloat = 1 /// The height of the carousel. Default is 300. public var collectionViewHeight: NSLayoutConstraint? @@ -51,7 +57,7 @@ open class Carousel: View { public var pagingView: (UIView & CarouselPageControlProtocol)? /// If the carousel should loop after scrolling past the first and final cells. - var loop = false + public var loop = false private var dragging = false @@ -81,6 +87,8 @@ open class Carousel: View { showPeaking(false) // Go to current cell. layoutIfNeeded is needed otherwise cellForItem returns nil for peaking logic. The dispatch is a sad way to ensure the collection view is ready to be scrolled. + guard let model = model as? CarouselModel, + (model.paging == true || model.loop == true) else { return } DispatchQueue.main.async { self.collectionView.scrollToItem(at: IndexPath(row: self.currentIndex, section: 0), at: self.itemAlignment, animated: false) self.collectionView.layoutIfNeeded() @@ -98,15 +106,23 @@ open class Carousel: View { collectionView.delegate = self addSubview(collectionView) bottomPin = NSLayoutConstraint.constraintPinSubview(toSuperview: collectionView)?[ConstraintBot] as? NSLayoutConstraint - collectionViewHeight = collectionView.heightAnchor.constraint(equalToConstant: 300) - collectionViewHeight?.isActive = false + collectionViewHeight?.isActive = true } open override func updateView(_ size: CGFloat) { super.updateView(size) self.size = size + // Set insets for the carousel. + var inset = UIEdgeInsets.zero + let carouselModel = model as? CarouselModel + if carouselModel?.useHorizontalMargins ?? false { + inset.left = carouselModel?.leftPadding ?? Padding.Component.horizontalPaddingForSize(size) + inset.right = carouselModel?.rightPadding ?? Padding.Component.horizontalPaddingForSize(size) + } + (collectionView.collectionViewLayout as? UICollectionViewFlowLayout)?.sectionInset = inset + // Update cells and re-layout. for cell in collectionView.visibleCells { (cell as? MVMCoreViewProtocol)?.updateView(size) @@ -128,19 +144,19 @@ open class Carousel: View { collectionView.layer.borderColor = backgroundColor?.cgColor collectionView.layer.borderWidth = (carouselModel.border ?? false) ? 1 : 0 backgroundColor = .white - - registerCells(with: carouselModel, delegateObject: delegateObject) - setupLayout(with: carouselModel) - prepareMolecules(with: carouselModel) - itemWidthPercent = (carouselModel.itemWidthPercent ?? 100) / 100 + (collectionView.collectionViewLayout as? UICollectionViewFlowLayout)?.minimumLineSpacing = carouselModel.spacing ?? 0 + + itemWidthPercent = carouselModel.itemWidthPercent / 100.0 if let alignment = carouselModel.itemAlignment { itemAlignment = alignment } if let height = carouselModel.height { - collectionViewHeight?.constant = CGFloat(height) - collectionViewHeight?.isActive = true + collectionViewHeight?.constant = height } + + registerCells(with: carouselModel, delegateObject: delegateObject) + prepareMolecules(with: carouselModel) setupPagingMolecule(carouselModel.pagingMolecule, delegateObject: delegateObject) @@ -153,16 +169,6 @@ open class Carousel: View { // MARK: - JSON Setters //-------------------------------------------------- - /// Updates the layout being used - func setupLayout(with carouselModel: CarouselModel?) { - - let layout = UICollectionViewFlowLayout() - layout.scrollDirection = .horizontal - layout.minimumLineSpacing = CGFloat(carouselModel?.spacing ?? 1) - layout.minimumInteritemSpacing = 0 - collectionView.collectionViewLayout = layout - } - func prepareMolecules(with carouselModel: CarouselModel?) { guard let newMolecules = carouselModel?.molecules else { numberOfPages = 0 @@ -191,7 +197,7 @@ open class Carousel: View { pagingView = MoleculeObjectMapping.shared()?.createMolecule(molecule, delegateObject: delegateObject) as? (UIView & CarouselPageControlProtocol) } - addPaging(view: pagingView, position: (CGFloat(molecule?.position ?? 20))) + addPaging(view: pagingView, position: molecule?.position ?? 20) } /// Registers the cells with the collection view @@ -294,7 +300,7 @@ open class Carousel: View { extension Carousel: UICollectionViewDelegateFlowLayout { open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { - let itemWidth = collectionView.bounds.width * CGFloat(itemWidthPercent) + let itemWidth = collectionView.bounds.width * itemWidthPercent return CGSize(width: itemWidth, height: collectionView.bounds.height) } @@ -324,8 +330,15 @@ extension Carousel: UICollectionViewDataSource { } } +extension Carousel: UICollectionViewDelegate { + open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + (collectionView.cellForItem(at: indexPath) as? CollectionTemplateItemProtocol)?.didSelectCell(at: indexPath, delegateObject: delegateObject, additionalData: nil) + } +} + extension Carousel: UIScrollViewDelegate { + /// Go to the cell at the specified index. func goTo(_ index: Int, animated: Bool) { showPeaking(false) @@ -339,51 +352,33 @@ extension Carousel: UIScrollViewDelegate { } } - func handleUserOnBufferCell() { - guard loop else { return } - - let lastPageIndex = numberOfPages + 1 - let goToIndex = { (index: Int) in - self.goTo(index, animated: false) - self.collectionView.layoutIfNeeded() - self.pagingView?.currentIndex = self.pageIndex - } - - if currentIndex < 2 { - // If on a "buffer" last row (which is the first index), go to the real last row secretly. layoutIfNeeded is needed otherwise cellForItem returns nil for peaking. - goToIndex(lastPageIndex) - } else if currentIndex > lastPageIndex { - // If on the "buffer" first row (which is the index after the real last row), go to the real first row secretly. - goToIndex(2) - } - } - - func checkForDraggingOutOfBounds(_ scrollView: UIScrollView) { - - guard loop, dragging else { return } - - // Checks if the user is not paging but attempting to drag endlessly and goes out of bounds. Caps the index. - if let separatorWidth = (collectionView.collectionViewLayout as? UICollectionViewFlowLayout)?.minimumLineSpacing { - let itemWidth = collectionView.bounds.width * CGFloat(itemWidthPercent) - let index = scrollView.contentOffset.x / (itemWidth + separatorWidth) - let lastCellIndex = collectionView(collectionView, numberOfItemsInSection: 0) - 1 - - if index < 1 { - currentIndex = 0 - updateModelIndex() - } else if index > CGFloat(lastCellIndex - 1) { - currentIndex = lastCellIndex - updateModelIndex() + /// Adjusts the current contentOffset if we are going onto buffer cells while looping to help with the endless scrolling appearance. + func adjustOffsetForLooping(_ scrollView: UIScrollView) { + let translatedPoint = scrollView.panGestureRecognizer.translation(in: scrollView.superview).x + if translatedPoint > 0 { + // Moving left, see if we are moving passed the first left buffer card and adjust + if let threshold = collectionView.layoutAttributesForItem(at: IndexPath(item: 1, section: 0))?.frame.minX, + scrollView.contentOffset.x < threshold, + let newOffset = collectionView.layoutAttributesForItem(at: IndexPath(item: numberOfPages + 1, section: 0))?.frame.minX { + scrollView.contentOffset.x = newOffset + } + } else if translatedPoint < 0 { + // Moving right, see if we are moving passed the first right buffer card and adjust + if let threshold = collectionView.layoutAttributesForItem(at: IndexPath(item: numberOfPages + 2, section: 0))?.frame.maxX, + scrollView.contentOffset.x + scrollView.bounds.width > threshold, + let newEndOffset = collectionView.layoutAttributesForItem(at: IndexPath(item: 2, section: 0))?.frame.maxX { + scrollView.contentOffset.x = newEndOffset - scrollView.bounds.width } } - - handleUserOnBufferCell() } open func scrollViewDidScroll(_ scrollView: UIScrollView) { - - // Check if the user is dragging the card even further past the next card. - //checkForDraggingOutOfBounds(scrollView) + + // Adjust for looping + if let model = model as? CarouselModel, + model.loop == true { + adjustOffsetForLooping(scrollView) + } // Let the pager know our progress if needed. pagingView?.scrollViewDidScroll(collectionView) @@ -391,6 +386,7 @@ extension Carousel: UIScrollViewDelegate { public func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { + // Disable peaking when dragging. dragging = true showPeaking(false) } @@ -398,32 +394,63 @@ extension Carousel: UIScrollViewDelegate { public func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer) { dragging = false - targetContentOffset.pointee = scrollView.contentOffset - // This is for setting up smooth custom paging. (Since UICollectionView only handles paging based on collection view size and not cell size). - guard let separatorWidth = (collectionView.collectionViewLayout as? UICollectionViewFlowLayout)?.minimumLineSpacing else { return } + // This is for setting up smooth custom paging. (Since UICollectionView only handles paging based on collection view size and not cell size). Math requires that we are using UICollectionViewFlowLayout. + guard (model as? CarouselModel)?.paging == true, + let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout else { return } - // We switch cards if we pass the velocity threshold or position threshold (currently 50%). - let itemWidth = collectionView.bounds.width * CGFloat(itemWidthPercent) - var cellToSwipeTo = Int(scrollView.contentOffset.x / (itemWidth + separatorWidth) + 0.5) - let lastCellIndex = collectionView(collectionView, numberOfItemsInSection: 0) - 1 - let velocityThreshold: CGFloat = 1.1 + let separatorWidth = layout.minimumLineSpacing + let itemWidth = collectionView.bounds.width * itemWidthPercent + let width = itemWidth + separatorWidth - if velocity.x > velocityThreshold { - cellToSwipeTo = currentIndex + 1 - - } else if velocity.x < -velocityThreshold { - cellToSwipeTo = currentIndex - 1 + // Adjusts the offset for the contentInset. Adds imaginary half separator to the left of the first card, which is necessary for determining the percent of a given card we are currently at. + let adjustedOffset = scrollView.contentOffset.x - layout.sectionInset.left + (separatorWidth / 2) + + // Calculates the offset per card depending on the alignment. + var offsetByCard: CGFloat + switch itemAlignment { + case .right: + offsetByCard = ((adjustedOffset + scrollView.bounds.width) / width) - 1 + case .centeredHorizontally: + offsetByCard = ((adjustedOffset + (scrollView.bounds.width / 2)) / width) - 0.5 + default: + offsetByCard = adjustedOffset / width } + // Adjust card for velocity impact. + let velocityThreshold: CGFloat = 1.1 + var cellToSwipeTo: Int + if velocity.x > velocityThreshold { + cellToSwipeTo = Int(ceil(offsetByCard)) + } else if velocity.x < -velocityThreshold { + cellToSwipeTo = Int(floor(offsetByCard)) + } else { + cellToSwipeTo = Int(round(offsetByCard)) + } + + // If we are swiping to a buffer cell, change to real cell before beginning animation so we don't go out of bounds. + if cellToSwipeTo < 2 { + let newOffset = scrollView.contentOffset.x + (width * CGFloat(numberOfPages)) + scrollView.contentOffset.x = newOffset + targetContentOffset.pointee.x = newOffset + cellToSwipeTo = cellToSwipeTo + numberOfPages + } else if cellToSwipeTo > numberOfPages + 1 { + let newOffset = scrollView.contentOffset.x - (width * CGFloat(numberOfPages)) + scrollView.contentOffset.x = newOffset + targetContentOffset.pointee.x = newOffset + cellToSwipeTo = cellToSwipeTo - numberOfPages + } else { + targetContentOffset.pointee = scrollView.contentOffset + } + // Cap the index. + let lastCellIndex = collectionView(collectionView, numberOfItemsInSection: 0) - 1 goTo(min(max(cellToSwipeTo, 0), lastCellIndex), animated: true) } // To give the illusion of endless scrolling. Since we are always calling scrollToItem we can assume finished paging in here. public func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) { // Cycle to other end if on buffer cell. - handleUserOnBufferCell() pagingView?.currentIndex = pageIndex showPeaking(true) } diff --git a/MVMCoreUI/Atomic/Organisms/CarouselModel.swift b/MVMCoreUI/Atomic/Organisms/CarouselModel.swift index 5ff753aa..20915799 100644 --- a/MVMCoreUI/Atomic/Organisms/CarouselModel.swift +++ b/MVMCoreUI/Atomic/Organisms/CarouselModel.swift @@ -21,14 +21,18 @@ import UIKit public var backgroundColor: Color? public var molecules: [MoleculeModelProtocol & CarouselItemModelProtocol] public var index: Int = 0 - public var spacing: Float? + public var spacing: CGFloat? public var border: Bool? public var loop: Bool? - public var height: Float? - public var itemWidthPercent: Float? + public var height: CGFloat? + @Percent public var itemWidthPercent = 100 public var itemAlignment: UICollectionView.ScrollPosition? public var pagingMolecule: (CarouselPagingModelProtocol & MoleculeModelProtocol)? - + public var paging: Bool = true + public var useHorizontalMargins: Bool? + public var leftPadding: CGFloat? + public var rightPadding: CGFloat? + public init(molecules: [MoleculeModelProtocol & CarouselItemModelProtocol]) { self.molecules = molecules } @@ -49,6 +53,10 @@ import UIKit case itemWidthPercent case itemAlignment case pagingMolecule + case paging + case useHorizontalMargins + case leftPadding + case rightPadding } //-------------------------------------------------- @@ -60,13 +68,21 @@ import UIKit molecules = try typeContainer.decodeModels(codingKey: .molecules) index = try typeContainer.decodeIfPresent(Int.self, forKey: .index) ?? 0 backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) - spacing = try typeContainer.decodeIfPresent(Float.self, forKey: .spacing) + spacing = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .spacing) border = try typeContainer.decodeIfPresent(Bool.self, forKey: .border) loop = try typeContainer.decodeIfPresent(Bool.self, forKey: .loop) - height = try typeContainer.decodeIfPresent(Float.self, forKey: .height) - itemWidthPercent = try typeContainer.decodeIfPresent(Float.self, forKey: .itemWidthPercent) + height = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .height) + if let itemWidthPercent = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .itemWidthPercent) { + self.itemWidthPercent = itemWidthPercent + } itemAlignment = try typeContainer.decodeIfPresent(UICollectionView.ScrollPosition.self, forKey: .itemAlignment) pagingMolecule = try typeContainer.decodeModelIfPresent(codingKey: .pagingMolecule) + if let paging = try typeContainer.decodeIfPresent(Bool.self, forKey: .paging) { + self.paging = paging + } + useHorizontalMargins = try typeContainer.decodeIfPresent(Bool.self, forKey: .useHorizontalMargins) + leftPadding = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .leftPadding) + rightPadding = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .rightPadding) } public func encode(to encoder: Encoder) throws { @@ -74,12 +90,16 @@ import UIKit try container.encode(moleculeName, forKey: .moleculeName) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeModels(molecules, forKey: .molecules) - try container.encode(spacing, forKey: .spacing) - try container.encode(border, forKey: .border) - try container.encode(loop, forKey: .loop) - try container.encode(height, forKey: .height) + try container.encodeIfPresent(spacing, forKey: .spacing) + try container.encodeIfPresent(border, forKey: .border) + try container.encodeIfPresent(loop, forKey: .loop) + try container.encodeIfPresent(height, forKey: .height) try container.encode(itemWidthPercent, forKey: .itemWidthPercent) - try container.encode(itemAlignment, forKey: .itemAlignment) + try container.encodeIfPresent(itemAlignment, forKey: .itemAlignment) try container.encodeModelIfPresent(pagingMolecule, forKey: .pagingMolecule) + try container.encode(paging, forKey: .paging) + try container.encodeIfPresent(useHorizontalMargins, forKey: .useHorizontalMargins) + try container.encodeIfPresent(leftPadding, forKey: .leftPadding) + try container.encodeIfPresent(rightPadding, forKey: .rightPadding) } } diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselPagingModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselPagingModelProtocol.swift index 72138290..b3dc3f2f 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselPagingModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselPagingModelProtocol.swift @@ -10,5 +10,5 @@ import Foundation public protocol CarouselPagingModelProtocol { - var position: Float? { get } + var position: CGFloat? { get } } diff --git a/MVMCoreUI/Atomic/Templates/CollectionTemplate.swift b/MVMCoreUI/Atomic/Templates/CollectionTemplate.swift index be4273df..b65e96f1 100644 --- a/MVMCoreUI/Atomic/Templates/CollectionTemplate.swift +++ b/MVMCoreUI/Atomic/Templates/CollectionTemplate.swift @@ -131,7 +131,7 @@ import Foundation return cell } - public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + public override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { (collectionView.cellForItem(at: indexPath) as? CollectionTemplateItemProtocol)?.didSelectCell(at: indexPath, delegateObject: delegateObjectIVar, additionalData: nil) } diff --git a/MVMCoreUI/BaseClasses/CollectionViewCell.swift b/MVMCoreUI/BaseClasses/CollectionViewCell.swift index aa74d229..848509c9 100644 --- a/MVMCoreUI/BaseClasses/CollectionViewCell.swift +++ b/MVMCoreUI/BaseClasses/CollectionViewCell.swift @@ -10,7 +10,7 @@ import Foundation /// A base collection view cell with basic mvm functionality. -open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCoreViewProtocol, CollectionTemplateItemProtocol { +open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCoreViewProtocol, CollectionTemplateItemProtocol, MFButtonProtocol { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- @@ -25,10 +25,6 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo private var initialSetupPerformed = false - //-------------------------------------------------- - // MARK: - Properties - //-------------------------------------------------- - // MARK: - Inits public override init(frame: CGRect) { super.init(frame: .zero) @@ -47,10 +43,6 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo } } - //-------------------------------------------------- - // MARK: - Properties - //-------------------------------------------------- - // MARK: - MVMCoreViewProtocol open func setupView() { isAccessibilityElement = false @@ -68,16 +60,6 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo (molecule as? MVMCoreViewProtocol)?.updateView(size) } - open func reset() { - molecule?.reset() - backgroundColor = .mvmWhite - width = nil - } - - //-------------------------------------------------- - // MARK: - Properties - //-------------------------------------------------- - // MARK: - MoleculeViewProtocol open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { guard let model = model as? CollectionItemModelProtocol else { return } @@ -94,6 +76,12 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo } } + open func reset() { + molecule?.reset() + backgroundColor = .mvmWhite + width = nil + } + /// Convenience function. Adds a molecule to the view. open func addMolecule(_ molecule: MoleculeViewProtocol) { contentView.addSubview(molecule) @@ -109,6 +97,12 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo self.width = width } + // MARK: - Override + public func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) { + guard let action = model?.action else { return } + Button.performButtonAction(with: action, button: self, delegateObject: delegateObject, additionalData: additionalData) + } + // Column logic, set width. override open func preferredLayoutAttributesFitting(_ layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes { let autoLayoutAttributes = super.preferredLayoutAttributesFitting(layoutAttributes) diff --git a/MVMCoreUI/BaseClasses/Protocols/CollectionItemModelProtocol.swift b/MVMCoreUI/BaseClasses/Protocols/CollectionItemModelProtocol.swift index 9361ab1e..faed7548 100644 --- a/MVMCoreUI/BaseClasses/Protocols/CollectionItemModelProtocol.swift +++ b/MVMCoreUI/BaseClasses/Protocols/CollectionItemModelProtocol.swift @@ -9,5 +9,13 @@ import Foundation public protocol CollectionItemModelProtocol { - + var action: ActionModelProtocol? { get set } +} + +// Not a strict requirement. +public extension CollectionItemModelProtocol { + var action: ActionModelProtocol? { + get { return nil } + set { } + } } diff --git a/MVMCoreUI/BaseClasses/TableViewCell.swift b/MVMCoreUI/BaseClasses/TableViewCell.swift index 254a09f0..caaeec85 100644 --- a/MVMCoreUI/BaseClasses/TableViewCell.swift +++ b/MVMCoreUI/BaseClasses/TableViewCell.swift @@ -8,7 +8,7 @@ import UIKit -@objcMembers open class TableViewCell: UITableViewCell, MoleculeViewProtocol, MoleculeListCellProtocol, MVMCoreViewProtocol { +@objcMembers open class TableViewCell: UITableViewCell, MoleculeViewProtocol, MoleculeListCellProtocol, MVMCoreViewProtocol, MFButtonProtocol { open var molecule: MoleculeViewProtocol? open var listItemModel: ListItemModelProtocol? @@ -267,10 +267,8 @@ import UIKit } public func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - //TODO: Use object when handleAction is rewrote to handle action model - if let actionMap = self.listItemModel?.action?.toJSON() { - MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject) - } + guard let action = listItemModel?.action else { return } + Button.performButtonAction(with: action, button: self, delegateObject: delegateObject, additionalData: additionalData) } public func willDisplay() { diff --git a/MVMCoreUI/BaseControllers/ThreeLayerCollectionViewController.swift b/MVMCoreUI/BaseControllers/ThreeLayerCollectionViewController.swift index 88d8157a..4011f4f8 100644 --- a/MVMCoreUI/BaseControllers/ThreeLayerCollectionViewController.swift +++ b/MVMCoreUI/BaseControllers/ThreeLayerCollectionViewController.swift @@ -233,4 +233,8 @@ import Foundation } fatalError() } + + open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + (collectionView.cellForItem(at: indexPath) as? CollectionTemplateItemProtocol)?.didSelectCell(at: indexPath, delegateObject: delegateObjectIVar, additionalData: nil) + } } From 3286cb42929dc29436b491318f36364d5451ae18 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 4 Jun 2020 12:10:14 -0400 Subject: [PATCH 24/44] add check for single hiding pager --- MVMCoreUI/Atomic/Organisms/Carousel.swift | 3 ++- .../Protocols/ModelProtocols/CarouselPagingModelProtocol.swift | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Organisms/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel.swift index 4a55c425..abc0e74b 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel.swift @@ -193,7 +193,8 @@ open class Carousel: View { /// Sets up the paging molecule open func setupPagingMolecule(_ molecule: (CarouselPagingModelProtocol & MoleculeModelProtocol)?, delegateObject: MVMCoreUIDelegateObject?) { var pagingView: (UIView & CarouselPageControlProtocol)? = nil - if let molecule = molecule { + if let molecule = molecule, + (!molecule.hidesForSinglePage || numberOfPages > 1) { pagingView = MoleculeObjectMapping.shared()?.createMolecule(molecule, delegateObject: delegateObject) as? (UIView & CarouselPageControlProtocol) } diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselPagingModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselPagingModelProtocol.swift index b3dc3f2f..3bd03b3b 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselPagingModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselPagingModelProtocol.swift @@ -11,4 +11,5 @@ import Foundation public protocol CarouselPagingModelProtocol { var position: CGFloat? { get } + var hidesForSinglePage: Bool { get } } From 1822a9ed70539255623ddbd89a7a8252fa086a34 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 4 Jun 2020 12:12:40 -0400 Subject: [PATCH 25/44] reuse --- .../Atomic/Atoms/Views/CarouselIndicator/CarouselIndicator.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/CarouselIndicator.swift b/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/CarouselIndicator.swift index 6bff6e6b..48b6cddf 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/CarouselIndicator.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/CarouselIndicator.swift @@ -206,6 +206,7 @@ open class CarouselIndicator: Control, CarouselPageControlProtocol { isEnabled = model.enabled formatAccessibilityValue(index: currentIndex + 1, total: numberOfPages) + isHidden = model.hidesForSinglePage && numberOfPages <= 1 } //-------------------------------------------------- From f858f2e380ad259ebc2413dffb6341f992310b92 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 4 Jun 2020 21:19:30 -0400 Subject: [PATCH 26/44] add legacy support for navigation molecular fix navigation bugs. --- .../NavigationBar/NavigationItemModel.swift | 8 +++++++- .../NavigationItemModelProtocol.swift | 1 + MVMCoreUI/Categories/UIColor+Extension.swift | 14 +++++++++++++- MVMCoreUI/Containers/NavigationController.swift | 9 ++++++++- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift b/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift index 05aec0a3..bf926878 100644 --- a/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift @@ -18,6 +18,7 @@ public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProt public var backgroundColor: Color? public var tintColor: Color public var line: LineModel? + public var alwaysShowBackButton = false public var backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol)? = NavigationImageButtonModel(with: "back", action: ActionBackModel()) public var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? public var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? @@ -30,11 +31,13 @@ public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProt } private enum CodingKeys: String, CodingKey { + case moleculeName case title case hidden case backgroundColor case tintColor case line + case alwaysShowBackButton case backButton case showLeftPanelButton case showRightPanelButton @@ -49,6 +52,7 @@ public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProt backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) ?? Color(uiColor: .white) tintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .tintColor) ?? Color(uiColor: .black) line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) + alwaysShowBackButton = try typeContainer.decodeIfPresent(Bool.self, forKey: .alwaysShowBackButton) ?? false if let backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol) = try typeContainer.decodeModelIfPresent(codingKey: .backButton) { self.backButton = backButton } @@ -58,11 +62,13 @@ public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProt open func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) try container.encodeIfPresent(title, forKey: .title) try container.encode(hidden, forKey: .hidden) - try container.encode(backgroundColor, forKey: .backgroundColor) + try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encode(tintColor, forKey: .tintColor) try container.encodeIfPresent(line, forKey: .line) + try container.encode(alwaysShowBackButton, forKey: .alwaysShowBackButton) try container.encodeModelIfPresent(backButton, forKey: .backButton) try container.encodeModelsIfPresent(additionalLeftButtons, forKey: .additionalLeftButtons) try container.encodeModelsIfPresent(additionalRightButtons, forKey: .additionalRightButtons) diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift index e4017428..30db2aa6 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift @@ -14,6 +14,7 @@ public protocol NavigationItemModelProtocol { var backgroundColor: Color? { get set } var tintColor: Color { get set } var line: LineModel? { get set } + var alwaysShowBackButton: Bool { get set } var backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol)? { get set } var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? { get set } var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? { get set } diff --git a/MVMCoreUI/Categories/UIColor+Extension.swift b/MVMCoreUI/Categories/UIColor+Extension.swift index 27816af2..7c82788c 100644 --- a/MVMCoreUI/Categories/UIColor+Extension.swift +++ b/MVMCoreUI/Categories/UIColor+Extension.swift @@ -282,7 +282,9 @@ extension UIColor { guard let components = color.cgColor.components else { return nil } - if color.cgColor.numberOfComponents >= 3 { + let numberOfComponents = color.cgColor.numberOfComponents + if numberOfComponents >= 3 { + // RGB color space let r = Int(CGFloat(components[0]) * 255) let g = Int(CGFloat(components[1]) * 255) let b = Int(CGFloat(components[2]) * 255) @@ -294,6 +296,16 @@ extension UIColor { } return String(format: "%02X%02X%02X", r, g, b) + } else if numberOfComponents == 2 { + // Monochromatic color space + let value = Int(CGFloat(components[0]) * 255) + + // If alpha of color is less than 1.0 then alpha hex is relevant. + if components[1] < 1.0 { + let alpha = Int(CGFloat(components[1]) * 255) + return String(format: "%02X%02X%02X%02X", value, value, value, alpha) + } + return String(format: "%02X%02X%02X", value, value, value) } return nil diff --git a/MVMCoreUI/Containers/NavigationController.swift b/MVMCoreUI/Containers/NavigationController.swift index 6f3bf06f..bac5817c 100644 --- a/MVMCoreUI/Containers/NavigationController.swift +++ b/MVMCoreUI/Containers/NavigationController.swift @@ -48,7 +48,7 @@ import UIKit let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject var leftItems: [UIBarButtonItem] = [] if let backButtonModel = navigationItemModel.backButton, - navigationController.viewControllers.count > 1 { + navigationController.viewControllers.count > 1 || navigationItemModel.alwaysShowBackButton { leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) } if let leftItemModels = navigationItemModel.additionalLeftButtons { @@ -90,4 +90,11 @@ import UIKit // Sets up the navigation buttons. setNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) } + + /// Convenience setter for legacy files + public static func set(navigationController: UINavigationController, navigationJSON: [String: Any], viewController: UIViewController) { + let moleculeName = ModelRegistry.getType(for: navigationJSON.stringForkey(KeyMoleculeName), with: MoleculeModelProtocol.self) + guard let barModel = try? moleculeName?.decode(jsonDict: navigationJSON) as? (MoleculeModelProtocol & NavigationItemModelProtocol) else { return } + set(navigationController: navigationController, navigationItemModel: barModel, viewController: viewController) + } } From 0742fe8afbaf3ebfb0781f4b9811396826b383de Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Fri, 5 Jun 2020 15:25:04 +0530 Subject: [PATCH 27/44] Updated code as per review comments --- MVMCoreUI.xcodeproj/project.pbxproj | 12 ++--- .../CustomCollectionViewFlowLayout.swift | 34 ------------ MVMCoreUI/Atomic/Atoms/Selectors/Tag.swift | 3 +- .../Atomic/Atoms/Selectors/TagModel.swift | 5 +- .../Atomic/Atoms/Selectors/TagsList.swift | 14 +++-- .../Atoms/Selectors/TagsListModel.swift | 5 +- .../UICollectionViewLeftAlignedLayout.swift | 53 +++++++++++++++++++ 7 files changed, 69 insertions(+), 57 deletions(-) delete mode 100644 MVMCoreUI/Atomic/Atoms/Selectors/CustomCollectionViewFlowLayout.swift create mode 100644 MVMCoreUI/Atomic/Atoms/Selectors/UICollectionViewLeftAlignedLayout.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 8b6e581a..98d19f8a 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -215,6 +215,7 @@ AAC6F167243332E400F295C1 /* RadioSwatchesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAC6F166243332E400F295C1 /* RadioSwatchesModel.swift */; }; BB1D17E0244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */; }; BB1D17E2244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */; }; + BB258D37248A259000125E9D /* UICollectionViewLeftAlignedLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB258D36248A259000125E9D /* UICollectionViewLeftAlignedLayout.swift */; }; BB2BF0EA2452A9BB001D0FC2 /* ListDeviceComplexButtonSmall.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2BF0E92452A9BB001D0FC2 /* ListDeviceComplexButtonSmall.swift */; }; BB2BF0EC2452A9D5001D0FC2 /* ListDeviceComplexButtonSmallModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2BF0EB2452A9D5001D0FC2 /* ListDeviceComplexButtonSmallModel.swift */; }; BB2C968F24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */; }; @@ -222,7 +223,6 @@ BB2FB3BB247E7EBC00DF73CD /* TagCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3BA247E7EBC00DF73CD /* TagCollectionViewCell.swift */; }; BB2FB3BD247E7EF200DF73CD /* TagsList.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3BC247E7EF200DF73CD /* TagsList.swift */; }; BB2FB3BF247E7F0900DF73CD /* TagsListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3BE247E7F0900DF73CD /* TagsListModel.swift */; }; - BB2FB3C1247EC1EB00DF73CD /* CustomCollectionViewFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3C0247EC1EB00DF73CD /* CustomCollectionViewFlowLayout.swift */; }; BB47A586241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */; }; BB47A588241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift */; }; BB54C5202434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB54C51E2434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift */; }; @@ -654,6 +654,7 @@ AAC6F166243332E400F295C1 /* RadioSwatchesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatchesModel.swift; sourceTree = ""; }; BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonMediumModel.swift; sourceTree = ""; }; BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonMedium.swift; sourceTree = ""; }; + BB258D36248A259000125E9D /* UICollectionViewLeftAlignedLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UICollectionViewLeftAlignedLayout.swift; sourceTree = ""; }; BB2BF0E92452A9BB001D0FC2 /* ListDeviceComplexButtonSmall.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonSmall.swift; sourceTree = ""; }; BB2BF0EB2452A9D5001D0FC2 /* ListDeviceComplexButtonSmallModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonSmallModel.swift; sourceTree = ""; }; BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableTextLinkAllTextAndLinksModel.swift; sourceTree = ""; }; @@ -661,7 +662,6 @@ BB2FB3BA247E7EBC00DF73CD /* TagCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagCollectionViewCell.swift; sourceTree = ""; }; BB2FB3BC247E7EF200DF73CD /* TagsList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagsList.swift; sourceTree = ""; }; BB2FB3BE247E7F0900DF73CD /* TagsListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagsListModel.swift; sourceTree = ""; }; - BB2FB3C0247EC1EB00DF73CD /* CustomCollectionViewFlowLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomCollectionViewFlowLayout.swift; sourceTree = ""; }; BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsectionModel.swift; sourceTree = ""; }; BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsection.swift; sourceTree = ""; }; BB54C51E2434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableButtonAllTextAndLinks.swift; sourceTree = ""; }; @@ -1445,12 +1445,12 @@ D264FAA8243FE17A00D98315 /* Selectors */ = { isa = PBXGroup; children = ( + BB2FB3BE247E7F0900DF73CD /* TagsListModel.swift */, + BB2FB3BC247E7EF200DF73CD /* TagsList.swift */, + BB258D36248A259000125E9D /* UICollectionViewLeftAlignedLayout.swift */, BBC0C4FE24811DCA0087C44F /* TagModel.swift */, BBC0C4FC24811DBC0087C44F /* Tag.swift */, BB2FB3BA247E7EBC00DF73CD /* TagCollectionViewCell.swift */, - BB2FB3C0247EC1EB00DF73CD /* CustomCollectionViewFlowLayout.swift */, - BB2FB3BC247E7EF200DF73CD /* TagsList.swift */, - BB2FB3BE247E7F0900DF73CD /* TagsListModel.swift */, D264FAAB2441009400D98315 /* RadioBoxCollectionViewCell.swift */, BBAA4F01243D8E3B005AAD5F /* RadioBoxesModel.swift */, BBAA4EFF243D8E3B005AAD5F /* RadioBoxes.swift */, @@ -2205,7 +2205,6 @@ D260105D23D0BCD400764D80 /* Stack.swift in Sources */, 0A7EF85D23D8A95600B2AAD1 /* TextEntryFieldModel.swift in Sources */, BB54C5212434D92F0038326C /* ListRightVariableButtonAllTextAndLinksModel.swift in Sources */, - BB2FB3C1247EC1EB00DF73CD /* CustomCollectionViewFlowLayout.swift in Sources */, D2092349244A51D40044AD09 /* RadioSwatchModel.swift in Sources */, 8DD1E370243B3D0500D8F2DF /* ListThreeColumnInternationalData.swift in Sources */, D23EA802247EBED400D60C34 /* ImageBarButtonItem.swift in Sources */, @@ -2298,6 +2297,7 @@ 012A88DB238ED45900FE3DA1 /* CarouselModel.swift in Sources */, D2092355244FA0FD0044AD09 /* ThreeLayerTemplateModelProtocol.swift in Sources */, 0AE14F64238315D2005417F8 /* TextField.swift in Sources */, + BB258D37248A259000125E9D /* UICollectionViewLeftAlignedLayout.swift in Sources */, 0AB764D124460F6300E7FE72 /* UIDatePicker+Extension.swift in Sources */, D253BB9C245874F8002DE544 /* BGImageMolecule.swift in Sources */, D2C78CD224228BBD00B69FDE /* ActionOpenPanelModel.swift in Sources */, diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/CustomCollectionViewFlowLayout.swift b/MVMCoreUI/Atomic/Atoms/Selectors/CustomCollectionViewFlowLayout.swift deleted file mode 100644 index aadad8b9..00000000 --- a/MVMCoreUI/Atomic/Atoms/Selectors/CustomCollectionViewFlowLayout.swift +++ /dev/null @@ -1,34 +0,0 @@ -// -// CollectionViewCenterLayout.swift -// MVMCoreUI -// -// Created by Dhamodaram Nandi on 27/05/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import UIKit - - -class UICollectionViewCenterLayout: UICollectionViewFlowLayout { - - override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { - let attributesForElementsInRect = super.layoutAttributesForElements(in: rect) - var newAttributesForElementsInRect = [UICollectionViewLayoutAttributes]() - - var leftMargin: CGFloat = 0.0; - - for attributes in attributesForElementsInRect! { - if (attributes.frame.origin.x == self.sectionInset.left) { - leftMargin = self.sectionInset.left - } else { - var newLeftAlignedFrame = attributes.frame - newLeftAlignedFrame.origin.x = leftMargin - attributes.frame = newLeftAlignedFrame - } - leftMargin += attributes.frame.size.width + 8 - newAttributesForElementsInRect.append(attributes) - } - - return newAttributesForElementsInRect - } -} diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/Tag.swift b/MVMCoreUI/Atomic/Atoms/Selectors/Tag.swift index cd66ff12..92624647 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/Tag.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/Tag.swift @@ -19,7 +19,6 @@ import Foundation label.numberOfLines = 1 addSubview(label) NSLayoutConstraint.constraintPinSubview(label, pinTop: true, topConstant: 13, pinBottom: true, bottomConstant: 13, pinLeft: true, leftConstant: 15, pinRight: true, rightConstant: 15) - } // MARK: - MoleculeViewProtocol @@ -30,6 +29,6 @@ import Foundation @objc override open func updateView(_ size: CGFloat) { super.updateView(size) + label.updateView(size) } - } diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagModel.swift b/MVMCoreUI/Atomic/Atoms/Selectors/TagModel.swift index a6ee8685..3ab66b0d 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/TagModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/TagModel.swift @@ -18,13 +18,13 @@ import Foundation case label case action case backgroundColor - } required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) label = try typeContainer.decode(LabelModel.self, forKey: .label) - action = try typeContainer.decodeModelIfPresent(codingKey: .action) + action = try typeContainer.decodeModelIfPresent(codingKey: .action) + backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) } public func encode(to encoder: Encoder) throws { @@ -32,6 +32,5 @@ import Foundation try container.encode(moleculeName, forKey: .moleculeName) try container.encode(label, forKey: .label) try container.encodeModelIfPresent(action, forKey: .action) - } } diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift b/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift index f79d4290..bd3603dd 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift @@ -11,7 +11,6 @@ open class TagsList: View { public var collectionView: CollectionView! public var collectionViewHeight: NSLayoutConstraint! - private let itemSpacing: CGFloat = 12.0 private var tagsListModel: TagsListModel? { return model as? TagsListModel } @@ -27,6 +26,9 @@ open class TagsList: View { // Accounts for any collection size changes DispatchQueue.main.async { self.collectionView.collectionViewLayout.invalidateLayout() + self.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self) + self.collectionViewHeight.constant = self.collectionView.contentSize.height + self.collectionViewHeight.isActive = true } } @@ -36,7 +38,7 @@ open class TagsList: View { collectionView = createCollectionView() addSubview(collectionView) NSLayoutConstraint.constraintPinSubview(toSuperview: collectionView) - collectionViewHeight = collectionView.heightAnchor.constraint(equalToConstant: 200) + collectionViewHeight = collectionView.heightAnchor.constraint(equalToConstant: 300) collectionViewHeight?.isActive = true } @@ -49,10 +51,6 @@ open class TagsList: View { tags = tagsListModel.tags registerCells() collectionView.reloadData() - if let height = tagsListModel.height { - collectionViewHeight?.constant = CGFloat(height) - collectionViewHeight?.isActive = true - } } @objc override open func updateView(_ size: CGFloat) { @@ -64,11 +62,10 @@ open class TagsList: View { /// Creates the layout for the collection. open func createCollectionViewLayout() -> UICollectionViewLayout { - let layout = UICollectionViewCenterLayout() + let layout = UICollectionViewLeftAlignedLayout() layout.scrollDirection = .vertical layout.estimatedItemSize = CGSize(width: 140, height: 40) layout.minimumLineSpacing = 24.0 - layout.minimumInteritemSpacing = itemSpacing return layout } @@ -108,6 +105,7 @@ extension TagsList: UICollectionViewDelegate { open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { guard let tagModel = tags?[indexPath.row] else {return} + Button. if let data = try? tagModel.action?.encode(using: JSONEncoder()), let actionMap = try? JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.init()) as? [AnyHashable: Any]{ MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: nil, delegateObject: delegateObject) diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift b/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift index ff24c236..75d7c4e9 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift @@ -13,8 +13,7 @@ import Foundation public var backgroundColor: Color? public static var identifier: String = "tagsList" public var tags: [TagModel] - public var height: Float? - + private enum CodingKeys: String, CodingKey { case moleculeName case backgroundColor @@ -26,7 +25,6 @@ import Foundation let typeContainer = try decoder.container(keyedBy: CodingKeys.self) tags = try typeContainer.decode([TagModel].self, forKey: .tags) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) - height = try typeContainer.decodeIfPresent(Float.self, forKey: .height) } public func encode(to encoder: Encoder) throws { @@ -34,6 +32,5 @@ import Foundation try container.encode(moleculeName, forKey: .moleculeName) try container.encode(tags, forKey: .tags) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) - try container.encode(height, forKey: .height) } } diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/UICollectionViewLeftAlignedLayout.swift b/MVMCoreUI/Atomic/Atoms/Selectors/UICollectionViewLeftAlignedLayout.swift new file mode 100644 index 00000000..96dc3a63 --- /dev/null +++ b/MVMCoreUI/Atomic/Atoms/Selectors/UICollectionViewLeftAlignedLayout.swift @@ -0,0 +1,53 @@ +// +// UICollectionViewLeftAlignedLayout.swift +// MVMCoreUI +// +// Created by Dhamodaram Nandi on 05/06/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +class UICollectionViewLeftAlignedLayout: UICollectionViewFlowLayout { + override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { + guard let attributes = super.layoutAttributesForElements(in: rect) else { + return nil + } + + var rows = [Row]() + var currentRowY: CGFloat = -1 + + for attribute in attributes { + if currentRowY != attribute.frame.origin.y { + currentRowY = attribute.frame.origin.y + rows.append(Row(spacing: 10)) + } + rows.last?.add(attribute: attribute) + } + + rows.forEach { $0.tagLayout(collectionViewWidth: collectionView?.frame.width ?? 0) } + return rows.flatMap { $0.attributes } + } +} +class Row { + + var attributes = [UICollectionViewLayoutAttributes]() + var spacing: CGFloat = 0 + + init(spacing: CGFloat) { + self.spacing = spacing + } + + func add(attribute: UICollectionViewLayoutAttributes) { + attributes.append(attribute) + } + + func tagLayout(collectionViewWidth: CGFloat) { + let padding = 8 + var offset = padding + for attribute in attributes { + attribute.frame.origin.x = CGFloat(offset) + offset += Int(attribute.frame.width + spacing) + } + } +} From 02d93c56ac1df2f51531eba5699e1630f20ceac8 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Fri, 5 Jun 2020 15:36:19 +0530 Subject: [PATCH 28/44] removed spaces --- MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift | 1 - .../Atoms/Selectors/UICollectionViewLeftAlignedLayout.swift | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift b/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift index bd3603dd..b13ff216 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift @@ -105,7 +105,6 @@ extension TagsList: UICollectionViewDelegate { open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { guard let tagModel = tags?[indexPath.row] else {return} - Button. if let data = try? tagModel.action?.encode(using: JSONEncoder()), let actionMap = try? JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.init()) as? [AnyHashable: Any]{ MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: nil, delegateObject: delegateObject) diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/UICollectionViewLeftAlignedLayout.swift b/MVMCoreUI/Atomic/Atoms/Selectors/UICollectionViewLeftAlignedLayout.swift index 96dc3a63..ef01da4a 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/UICollectionViewLeftAlignedLayout.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/UICollectionViewLeftAlignedLayout.swift @@ -29,6 +29,7 @@ class UICollectionViewLeftAlignedLayout: UICollectionViewFlowLayout { return rows.flatMap { $0.attributes } } } + class Row { var attributes = [UICollectionViewLayoutAttributes]() From c3e4786d5bda79119be3570b3ffec6b7e9380138 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Fri, 5 Jun 2020 17:16:38 +0530 Subject: [PATCH 29/44] Updated to performButtonAction method --- MVMCoreUI/Atomic/Atoms/Selectors/Tag.swift | 1 + .../Selectors/TagCollectionViewCell.swift | 1 + .../Atomic/Atoms/Selectors/TagModel.swift | 1 + .../Atomic/Atoms/Selectors/TagsList.swift | 18 +++++------------- .../Atomic/Atoms/Selectors/TagsListModel.swift | 4 ++-- .../UICollectionViewLeftAlignedLayout.swift | 9 +++------ 6 files changed, 13 insertions(+), 21 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/Tag.swift b/MVMCoreUI/Atomic/Atoms/Selectors/Tag.swift index 92624647..1080c7a9 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/Tag.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/Tag.swift @@ -7,6 +7,7 @@ // import Foundation + @objcMembers open class Tag: View { public let label = Label.createLabelRegularBodySmall(true) diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagCollectionViewCell.swift b/MVMCoreUI/Atomic/Atoms/Selectors/TagCollectionViewCell.swift index 11ce0bff..2b1406d5 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/TagCollectionViewCell.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/TagCollectionViewCell.swift @@ -7,6 +7,7 @@ // import Foundation + open class TagCollectionViewCell: CollectionViewCell { public let tagLabel = Tag() diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagModel.swift b/MVMCoreUI/Atomic/Atoms/Selectors/TagModel.swift index 3ab66b0d..e0247e71 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/TagModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/TagModel.swift @@ -7,6 +7,7 @@ // import Foundation + @objcMembers public class TagModel: MoleculeModelProtocol { public static var identifier: String = "tag" public var label: LabelModel diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift b/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift index b13ff216..5a30f597 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift @@ -7,7 +7,8 @@ // import Foundation -open class TagsList: View { + +open class TagsList: View,MFButtonProtocol { public var collectionView: CollectionView! public var collectionViewHeight: NSLayoutConstraint! @@ -20,15 +21,14 @@ open class TagsList: View { /// The models for the molecules. public var tags: [TagModel]? - open override func layoutSubviews() { super.layoutSubviews() // Accounts for any collection size changes DispatchQueue.main.async { self.collectionView.collectionViewLayout.invalidateLayout() - self.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self) self.collectionViewHeight.constant = self.collectionView.contentSize.height self.collectionViewHeight.isActive = true + self.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self) } } @@ -46,7 +46,6 @@ open class TagsList: View { open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { super.set(with: model, delegateObject, additionalData) self.delegateObject = delegateObject - guard let tagsListModel = model as? TagsListModel else { return } tags = tagsListModel.tags registerCells() @@ -59,7 +58,6 @@ open class TagsList: View { } // MARK: - Creation - /// Creates the layout for the collection. open func createCollectionViewLayout() -> UICollectionViewLayout { let layout = UICollectionViewLeftAlignedLayout() @@ -81,7 +79,6 @@ open class TagsList: View { open func registerCells() { collectionView.register(TagCollectionViewCell.self, forCellWithReuseIdentifier: "TagCollectionViewCell") } - } extension TagsList: UICollectionViewDataSource { @@ -102,13 +99,8 @@ extension TagsList: UICollectionViewDataSource { } extension TagsList: UICollectionViewDelegate { - open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - guard let tagModel = tags?[indexPath.row] else {return} - if let data = try? tagModel.action?.encode(using: JSONEncoder()), - let actionMap = try? JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.init()) as? [AnyHashable: Any]{ - MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: nil, delegateObject: delegateObject) - } + guard let tagModel = tags?[indexPath.row], let tagAction = tagModel.action else {return} + Button.performButtonAction(with: tagAction, button: self, delegateObject: delegateObject, additionalData: nil) } } - diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift b/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift index 75d7c4e9..86de5206 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift @@ -7,13 +7,13 @@ // import Foundation -import Foundation + @objcMembers public class TagsListModel: MoleculeModelProtocol { public var backgroundColor: Color? public static var identifier: String = "tagsList" public var tags: [TagModel] - + private enum CodingKeys: String, CodingKey { case moleculeName case backgroundColor diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/UICollectionViewLeftAlignedLayout.swift b/MVMCoreUI/Atomic/Atoms/Selectors/UICollectionViewLeftAlignedLayout.swift index ef01da4a..d5568b57 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/UICollectionViewLeftAlignedLayout.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/UICollectionViewLeftAlignedLayout.swift @@ -13,10 +13,8 @@ class UICollectionViewLeftAlignedLayout: UICollectionViewFlowLayout { guard let attributes = super.layoutAttributesForElements(in: rect) else { return nil } - var rows = [Row]() var currentRowY: CGFloat = -1 - for attribute in attributes { if currentRowY != attribute.frame.origin.y { currentRowY = attribute.frame.origin.y @@ -24,7 +22,6 @@ class UICollectionViewLeftAlignedLayout: UICollectionViewFlowLayout { } rows.last?.add(attribute: attribute) } - rows.forEach { $0.tagLayout(collectionViewWidth: collectionView?.frame.width ?? 0) } return rows.flatMap { $0.attributes } } @@ -34,15 +31,15 @@ class Row { var attributes = [UICollectionViewLayoutAttributes]() var spacing: CGFloat = 0 - + init(spacing: CGFloat) { self.spacing = spacing } - + func add(attribute: UICollectionViewLayoutAttributes) { attributes.append(attribute) } - + func tagLayout(collectionViewWidth: CGFloat) { let padding = 8 var offset = padding From 93ed792856c57be13d03e61459550f0991cd5b36 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Fri, 5 Jun 2020 09:06:41 -0400 Subject: [PATCH 30/44] revised factory functions and methods --- .../Atomic/Atoms/Selectors/RadioBox.swift | 4 +- .../Atomic/Atoms/Selectors/RadioSwatch.swift | 2 +- .../NumericIndicatorView.swift | 2 +- .../Atomic/Atoms/Views/CheckboxLabel.swift | 2 +- .../Atomic/Atoms/Views/Label/Label.swift | 100 +++--------------- .../Atoms/Views/LeftRightLabelView.swift | 4 +- .../ListDeviceComplexButtonMedium.swift | 16 +-- .../Device/ListDeviceComplexButtonSmall.swift | 16 +-- .../Device/ListDeviceComplexLinkMedium.swift | 16 +-- .../Device/ListDeviceComplexLinkSmall.swift | 16 +-- .../ListFourColumnDataUsageListItem.swift | 16 +-- .../ListLeftVariableIconWithRightCaret.swift | 8 +- ...ftVariableIconWithRightCaretBodyText.swift | 4 +- ...tVariableNumberedListAllTextAndLinks.swift | 4 +- ...tVariableRadioButtonAndPaymentMethod.swift | 4 +- ...neColumnFullWidthTextAllTextAndLinks.swift | 16 +-- .../List/RightVariable/ListRVWheel.swift | 8 +- .../ListRightVariablePayments.swift | 4 +- ...htVariablePriceChangeAllTextAndLinks.swift | 2 +- ...ListRightVariablePriceChangeBodyText.swift | 2 +- .../ListRightVariableTotalData.swift | 8 +- .../ListThreeColumnDataUsage.swift | 12 +-- .../ListThreeColumnInternationalData.swift | 12 +-- .../ListTwoColumnCompareChanges.swift | 32 +++--- .../ListTwoColumnPriceDescription.swift | 16 +-- .../TwoColumn/ListTwoColumnPriceDetails.swift | 8 +- .../LockUps/ListProgressBarData.swift | 8 +- .../ListFourColumnDataUsageDivider.swift | 16 +-- ...ColumnFullWidthTextDividerSubsection.swift | 8 +- ...ColumnTextWithWhitespaceDividerShort.swift | 8 +- ...eColumnTextWithWhitespaceDividerTall.swift | 6 +- .../ListThreeColumnBillChangesDivider.swift | 12 +-- .../ListThreeColumnDataUsageDivider.swift | 12 +-- ...tThreeColumnInternationalDataDivider.swift | 12 +-- .../ListThreeColumnSpeedTestDivider.swift | 12 +-- .../ListTwoColumnSubsectionDivider.swift | 8 +- .../Doughnut/ColorViewWithLabel.swift | 2 +- .../Molecules/Doughnut/DoughnutChart.swift | 4 +- .../ImageHeadlineBody.swift | 4 +- .../LeftRightViews/CornerLabels.swift | 16 +-- .../ToggleMolecules/LabelToggle.swift | 4 +- .../EyebrowHeadlineBodyLink.swift | 12 +-- .../HeadlineBody.swift | 20 ++-- .../StringAndMoleculeView.swift | 2 +- 44 files changed, 216 insertions(+), 284 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/RadioBox.swift b/MVMCoreUI/Atomic/Atoms/Selectors/RadioBox.swift index 785d6ae6..1118ca33 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/RadioBox.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/RadioBox.swift @@ -9,8 +9,8 @@ import Foundation open class RadioBox: Control { - public let label = Label.createLabelRegularBodySmall(true) - public let subTextLabel = Label.createLabelRegularMicro(true) + public let label = Label(fontStyle: .RegularBodySmall) + public let subTextLabel = Label(fontStyle: .RegularMicro) public var isOutOfStock = false public var accentColor = UIColor.mvmRed diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatch.swift b/MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatch.swift index d7413e07..d3ac7d0b 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatch.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatch.swift @@ -13,7 +13,7 @@ open class RadioSwatch: Control { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- - public let bottomText = Label.createLabelRegularMicro(true) + public let bottomText = Label(fontStyle: .RegularMicro) private var circleLayer: CAShapeLayer? private var selectedLayer: CALayer? diff --git a/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/NumericIndicatorView.swift b/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/NumericIndicatorView.swift index 04ea2fcd..afbe30d4 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/NumericIndicatorView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/NumericIndicatorView.swift @@ -16,7 +16,7 @@ open class NumericIndicatorView: CarouselIndicator { /// Text to display the current count of total pages for viewing. open var pageCount: Label = { - let label = Label.createLabelRegularBodySmall(true) + let label = Label(fontStyle: .RegularBodySmall) label.isAccessibilityElement = false label.setContentCompressionResistancePriority(.required, for: .vertical) label.textAlignment = .center diff --git a/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift b/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift index 9d203ea9..281c306d 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift @@ -13,7 +13,7 @@ //-------------------------------------------------- public let checkbox = Checkbox() - public let label = Label.createLabelRegularBodySmall(true) + public let label = Label(fontStyle: .RegularBodySmall) //-------------------------------------------------- // MARK: - Properties diff --git a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift index d47a374f..14250f30 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift @@ -13,7 +13,6 @@ public typealias ActionBlock = () -> () @objcMembers open class Label: UILabel, MVMCoreViewProtocol, MoleculeViewProtocol, MVMCoreUIViewConstrainingProtocol, MFButtonProtocol { - //------------------------------------------------------ // MARK: - Properties //------------------------------------------------------ @@ -97,7 +96,7 @@ public typealias ActionBlock = () -> () accessibilityCustomActions = [] accessibilityTraits = .staticText - let tapGesture = UITapGestureRecognizer(target: self, action: #selector(textLinkTapped(_:))) + let tapGesture = UITapGestureRecognizer(target: self, action: #selector(textLinkTapped)) tapGesture.numberOfTapsRequired = 1 addGestureRecognizer(tapGesture) } @@ -117,6 +116,15 @@ public typealias ActionBlock = () -> () setupView() } + public init(fontStyle: Styler.Font, _ scale: Bool = true) { + super.init(frame: .zero) + setupView() + + font = fontStyle.getFont(false) + textColor = .mvmBlack + setScale(scale) + } + @objc convenience public init(standardFontSize size: CGFloat) { self.init() standardFontSize = size @@ -142,88 +150,6 @@ public typealias ActionBlock = () -> () // MARK: - Factory Functions //------------------------------------------------------ - /// Title 2XLarge - @objc public static func createLabelTitle2XLarge(_ scale: Bool) -> Label { - let label = Label.label() - label.styleTitle2XLarge(scale) - return label - } - - /// TitleXLarge - @objc public static func createLabelTitleXLarge(_ scale: Bool) -> Label { - let label = Label.label() - label.styleTitleXLarge(scale) - return label - } - - /// BoldTitleLarge - @objc public static func createLabelBoldTitleLarge(_ scale: Bool) -> Label { - let label = Label.label() - label.styleBoldTitleLarge(scale) - return label - } - - /// RegularTitleLarge - @objc public static func createLabelRegularTitleLarge(_ scale: Bool) -> Label { - let label = Label.label() - label.styleRegularTitleLarge(scale) - return label - } - - /// BoldTitleMedium - @objc public static func createLabelBoldTitleMedium(_ scale: Bool) -> Label { - let label = Label.label() - label.styleBoldTitleMedium(scale) - return label - } - - /// RegularTitleMedium - @objc public static func createLabelRegularTitleMedium(_ scale: Bool) -> Label { - let label = Label.label() - label.styleRegularTitleMedium(scale) - return label - } - - /// BoldBodyLarge - @objc public static func createLabelBoldBodyLarge(_ scale: Bool) -> Label { - let label = Label.label() - label.styleBoldBodyLarge(scale) - return label - } - - /// RegularBodyLarge - @objc public static func createLabelRegularBodyLarge(_ scale: Bool) -> Label { - let label = Label.label() - label.styleRegularBodyLarge(scale) - return label - } - - /// BoldBodySmall - @objc public static func createLabelBoldBodySmall(_ scale: Bool) -> Label { - let label = Label.label() - label.styleBoldBodySmall(scale) - return label - } - - /// RegularBodySmall - @objc public static func createLabelRegularBodySmall(_ scale: Bool) -> Label { - let label = Label.label() - label.styleRegularBodySmall(scale) - return label - } - /// BoldMicro - @objc public static func createLabelBoldMicro(_ scale: Bool) -> Label { - let label = Label.label() - label.styleBoldMicro(scale) - return label - } - /// RegularMicro - @objc public static func createLabelRegularMicro(_ scale: Bool) -> Label { - let label = Label.label() - label.styleRegularMicro(scale) - return label - } - //2.0 fonts init methods /// H1 -> HeadlineLarge @objc public static func commonLabelH1(_ scale: Bool) -> Label { @@ -572,6 +498,12 @@ public typealias ActionBlock = () -> () // MARK: - Methods //------------------------------------------------------ + public func setFontStyle(_ fontStyle: Styler.Font, _ scale: Bool = true) { + font = fontStyle.getFont(false) + textColor = .mvmBlack + setScale(scale) + } + //mva 3.0 font @objc public func styleTitle2XLarge(_ scale: Bool) { MFStyler.styleLabelTitle2XLarge(self, genericScaling: false) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LeftRightLabelView.swift b/MVMCoreUI/Atomic/Atoms/Views/LeftRightLabelView.swift index a7d85f86..3981152a 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LeftRightLabelView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LeftRightLabelView.swift @@ -14,8 +14,8 @@ import Foundation // MARK: - Outlets //------------------------------------------------------ - let leftTextLabel = Label.createLabelBoldBodySmall(true) - let rightTextLabel = Label.createLabelBoldBodySmall(true) + let leftTextLabel = Label(fontStyle: .BoldBodySmall) + let rightTextLabel = Label(fontStyle: .BoldBodySmall) //------------------------------------------------------ // MARK: - Constraints diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift index e6e226cb..a96e1047 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift @@ -10,10 +10,10 @@ import Foundation @objcMembers open class ListDeviceComplexButtonMedium: TableViewCell { public var verticalStack: Stack - public let eyebrow = Label.createLabelRegularMicro(true) - public let headline = Label.createLabelBoldTitleMedium(true) - public let body = Label.createLabelRegularBodySmall(true) - public let body2 = Label.createLabelRegularBodySmall(true) + public let eyebrow = Label(fontStyle: .RegularMicro) + public let headline = Label(fontStyle: .BoldTitleMedium) + public let body = Label(fontStyle: .RegularBodySmall) + public let body2 = Label(fontStyle: .RegularBodySmall) public let button = PillButton(frame: .zero) public let rightImageView = LoadImageView() public var stack: Stack @@ -67,10 +67,10 @@ import Foundation } public func setDefault() { - eyebrow.styleRegularMicro(true) - headline.styleBoldTitleMedium(true) - body.styleRegularBodySmall(true) - body2.styleRegularBodySmall(true) + eyebrow.setFontStyle(.RegularMicro) + headline.setFontStyle(.BoldTitleMedium) + body.setFontStyle(.RegularBodySmall) + body2.setFontStyle(.RegularBodySmall) eyebrow.textColor = .mvmCoolGray6 } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift index e8436620..3f276a2c 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift @@ -10,10 +10,10 @@ import Foundation @objcMembers open class ListDeviceComplexButtonSmall: TableViewCell { public var verticalStack: Stack - public let eyebrow = Label.createLabelRegularMicro(true) - public let headline = Label.createLabelBoldTitleMedium(true) - public let body = Label.createLabelRegularBodySmall(true) - public let body2 = Label.createLabelRegularBodySmall(true) + public let eyebrow = Label(fontStyle: .RegularMicro) + public let headline = Label(fontStyle: .BoldTitleMedium) + public let body = Label(fontStyle: .RegularBodySmall) + public let body2 = Label(fontStyle: .RegularBodySmall) public let button = PillButton(frame: .zero) public let rightImageView = LoadImageView() public var stack: Stack @@ -67,10 +67,10 @@ import Foundation } public func setDefault() { - eyebrow.styleRegularMicro(true) - headline.styleBoldTitleMedium(true) - body.styleRegularBodySmall(true) - body2.styleRegularBodySmall(true) + eyebrow.setFontStyle(.RegularMicro) + headline.setFontStyle(.BoldTitleMedium) + body.setFontStyle(.RegularBodySmall) + body2.setFontStyle(.RegularBodySmall) eyebrow.textColor = .mvmCoolGray6 } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMedium.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMedium.swift index 573335c0..d3262203 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMedium.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMedium.swift @@ -12,10 +12,10 @@ import Foundation //----------------------------------------------------- // MARK: - Outlets //----------------------------------------------------- - public let eyebrow = Label.createLabelRegularMicro(true) - public let headline = Label.createLabelBoldTitleMedium(true) - public let body = Label.createLabelRegularBodySmall(true) - public let body2 = Label.createLabelRegularBodySmall(true) + public let eyebrow = Label(fontStyle: .RegularMicro) + public let headline = Label(fontStyle: .BoldTitleMedium) + public let body = Label(fontStyle: .RegularBodySmall) + public let body2 = Label(fontStyle: .RegularBodySmall) public let twoLinkView = TwoLinkView() public let rightImage = LoadImageView() let verticalStack: Stack @@ -68,10 +68,10 @@ import Foundation open override func reset() { super.reset() - eyebrow.styleRegularMicro(true) - headline.styleBoldTitleMedium(true) - body.styleRegularBodySmall(true) - body2.styleRegularBodySmall(true) + eyebrow.setFontStyle(.RegularMicro) + headline.setFontStyle(.BoldTitleMedium) + body.setFontStyle(.RegularBodySmall) + body2.setFontStyle(.RegularBodySmall) eyebrow.textColor = .mvmCoolGray6 } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkSmall.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkSmall.swift index 49173067..2637fde8 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkSmall.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkSmall.swift @@ -12,10 +12,10 @@ import Foundation //----------------------------------------------------- // MARK: - Outlets //----------------------------------------------------- - public let eyebrow = Label.createLabelRegularMicro(true) - public let headline = Label.createLabelBoldTitleMedium(true) - public let body = Label.createLabelRegularBodySmall(true) - public let body2 = Label.createLabelRegularBodySmall(true) + public let eyebrow = Label(fontStyle: .RegularMicro) + public let headline = Label(fontStyle: .BoldTitleMedium) + public let body = Label(fontStyle: .RegularBodySmall) + public let body2 = Label(fontStyle: .RegularBodySmall) public let twoLinkView = TwoLinkView() public let rightImage = LoadImageView() let verticalStack: Stack @@ -68,10 +68,10 @@ import Foundation open override func reset() { super.reset() - eyebrow.styleRegularMicro(true) - headline.styleBoldTitleMedium(true) - body.styleRegularBodySmall(true) - body2.styleRegularBodySmall(true) + eyebrow.setFontStyle(.RegularMicro) + headline.setFontStyle(.BoldTitleMedium) + body.setFontStyle(.RegularBodySmall) + body2.setFontStyle(.RegularBodySmall) eyebrow.textColor = .mvmCoolGray6 } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/FourColumn/ListFourColumnDataUsageListItem.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/FourColumn/ListFourColumnDataUsageListItem.swift index a42b6797..4bf844e2 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/FourColumn/ListFourColumnDataUsageListItem.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/FourColumn/ListFourColumnDataUsageListItem.swift @@ -14,10 +14,10 @@ import Foundation // MARK: - Outlets //----------------------------------------------------- var stack: Stack - let label1 = Label.createLabelRegularBodySmall(true) - let label2 = Label.createLabelRegularBodySmall(true) - let label3 = Label.createLabelRegularBodySmall(true) - let label4 = Label.createLabelRegularBodySmall(true) + let label1 = Label(fontStyle: .RegularBodySmall) + let label2 = Label(fontStyle: .RegularBodySmall) + let label3 = Label(fontStyle: .RegularBodySmall) + let label4 = Label(fontStyle: .RegularBodySmall) let arrow = Arrow(frame: .zero) let arrowAndLabel2Stack: Stack @@ -69,9 +69,9 @@ import Foundation open override func reset() { super.reset() - label1.styleRegularBodySmall(true) - label2.styleRegularBodySmall(true) - label3.styleRegularBodySmall(true) - label4.styleRegularBodySmall(true) + label1.setFontStyle(.RegularBodySmall) + label2.setFontStyle(.RegularBodySmall) + label3.setFontStyle(.RegularBodySmall) + label4.setFontStyle(.RegularBodySmall) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift index db7decbd..4ab804b9 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift @@ -14,8 +14,8 @@ import UIKit // MARK: - Outlets //------------------------------------------------------- let leftImage = LoadImageView(pinnedEdges: .all) - let leftLabel = Label.createLabelRegularBodySmall(true) - let rightLabel = Label.createLabelRegularBodySmall(true) + let leftLabel = Label(fontStyle: .RegularBodySmall) + let rightLabel = Label(fontStyle: .RegularBodySmall) var stack: Stack //----------------------------------------------------- @@ -63,7 +63,7 @@ import UIKit open override func reset() { super.reset() - leftLabel.styleRegularBodySmall(true) - rightLabel.styleRegularBodySmall(true) + leftLabel.setFontStyle(.RegularBodySmall) + rightLabel.setFontStyle(.RegularBodySmall) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift index e508c8f4..eee1b7d4 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift @@ -13,7 +13,7 @@ import Foundation //------------------------------------------------------- public let leftImage = LoadImageView() public let headlineBody = HeadlineBody() - public let rightLabel = Label.createLabelRegularBodySmall(true) + public let rightLabel = Label(fontStyle: .RegularBodySmall) public let rightLabelStackItem: StackItem public var stack: Stack @@ -73,6 +73,6 @@ import Foundation open override func reset() { super.reset() - rightLabel.styleRegularBodySmall(true) + rightLabel.setFontStyle(.RegularBodySmall) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift index d623311b..54e7bc52 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift @@ -12,7 +12,7 @@ import Foundation //----------------------------------------------------- // MARK: - Outlets //----------------------------------------------------- - public let leftLabel = Label.createLabelTitle2XLarge(true) + public let leftLabel = Label(fontStyle: .Title2XLarge) public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero) public var stack: Stack @@ -56,7 +56,7 @@ import Foundation open override func reset() { super.reset() - leftLabel.styleTitle2XLarge(true) + leftLabel.setFontStyle(.Title2XLarge) } open override func layoutSubviews() { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift index 7ee0b619..63056d61 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift @@ -47,7 +47,7 @@ import UIKit addMolecule(stack) stack.restack() eyebrowHeadlineBodyLink.body.textColor = .mvmOrangeAA - eyebrowHeadlineBodyLink.headline.styleBoldBodySmall(true) + eyebrowHeadlineBodyLink.headline.setFontStyle(.BoldBodySmall) accessibilityTraits = radioButton.accessibilityTraits accessibilityHint = radioButton.accessibilityHint @@ -61,7 +61,7 @@ import UIKit open override func reset() { super.reset() eyebrowHeadlineBodyLink.body.textColor = .mvmOrangeAA - eyebrowHeadlineBodyLink.headline.styleBoldBodySmall(true) + eyebrowHeadlineBodyLink.headline.setFontStyle(.BoldBodySmall) } //---------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift index 2291c080..f17c9535 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift @@ -15,10 +15,10 @@ import Foundation //----------------------------------------------------- var stack: Stack - let eyebrow = Label.createLabelRegularMicro(true) - let headline = Label.createLabelBoldTitleMedium(true) - let subHeadline = Label.createLabelBoldBodySmall(true) - let body = Label.createLabelRegularBodySmall(true) + let eyebrow = Label(fontStyle: .RegularMicro) + let headline = Label(fontStyle: .BoldTitleMedium) + let subHeadline = Label(fontStyle: .BoldBodySmall) + let body = Label(fontStyle: .RegularBodySmall) let link = Link() //----------------------------------------------------- @@ -62,9 +62,9 @@ import Foundation open override func reset() { super.reset() - eyebrow.styleRegularMicro(true) - headline.styleBoldTitleMedium(true) - subHeadline.styleBoldBodySmall(true) - body.styleRegularBodySmall(true) + eyebrow.setFontStyle(.RegularMicro) + headline.setFontStyle(.BoldTitleMedium) + subHeadline.setFontStyle(.BoldBodySmall) + body.setFontStyle(.RegularBodySmall) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift index 40579a09..33822f80 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift @@ -9,8 +9,8 @@ import Foundation @objcMembers open class ListRVWheel: TableViewCell { let wheel = Wheel(frame: .zero) - let leftLabel = Label.createLabelBoldBodySmall(true) - let rightLabel = Label.createLabelRegularBodySmall(true) + let leftLabel = Label(fontStyle: .BoldBodySmall) + let rightLabel = Label(fontStyle: .RegularBodySmall) var stack: Stack //----------------------------------------------------- @@ -54,8 +54,8 @@ import Foundation //------------------------------------------------- open override func reset() { super.reset() - leftLabel.styleBoldBodySmall(true) - rightLabel.styleRegularBodySmall(true) + leftLabel.setFontStyle(.BoldBodySmall) + rightLabel.setFontStyle(.RegularBodySmall) } public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index ce73c082..767ac01f 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -13,7 +13,7 @@ import Foundation //----------------------------------------------------- // MARK: - Outlets //------------------------------------------------------- - let leftLabel = Label.createLabelBoldBodySmall(true) + let leftLabel = Label(fontStyle: .BoldBodySmall) let rightImage = LoadImageView(pinnedEdges: .all) var stack: Stack @@ -57,6 +57,6 @@ import Foundation open override func reset() { super.reset() - leftLabel.styleBoldBodySmall(true) + leftLabel.setFontStyle(.BoldBodySmall) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift index ab135eb6..aef75633 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift @@ -15,7 +15,7 @@ import Foundation //----------------------------------------------------- public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero) public let arrow = Arrow(frame: .zero) - public let rightLabel = Label.createLabelRegularBodySmall(true) + public let rightLabel = Label(fontStyle: .Title2XLarge) private let stack: Stack private let arrowStackItem: StackItem private let rightLabelStackItem: StackItem diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift index 63e90d34..66302b5f 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift @@ -15,7 +15,7 @@ import Foundation private let stack: Stack public let headlineBody = HeadlineBody(frame: .zero) public let arrow = Arrow(frame: .zero) - public let rightLabel = Label.createLabelRegularBodySmall(true) + public let rightLabel = Label(fontStyle: .RegularBodySmall) let arrowAndRightLabelStack: Stack diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift index bb6ebd9e..9bb29582 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift @@ -14,8 +14,8 @@ import Foundation // MARK: - Outlets //----------------------------------------------------- public var stack: Stack - public let leftLabel = Label.createLabelBoldBodySmall(true) - public let rightLabel = Label.createLabelRegularBodySmall(true) + public let leftLabel = Label(fontStyle: .BoldBodySmall) + public let rightLabel = Label(fontStyle: .RegularBodySmall) public let bar = Line() //----------------------------------------------------- @@ -61,8 +61,8 @@ import Foundation open override func reset() { super.reset() - leftLabel.styleBoldBodySmall(true) - rightLabel.styleRegularBodySmall(true) + leftLabel.setFontStyle(.BoldBodySmall) + rightLabel.setFontStyle(.RegularBodySmall) bar.setStyle(.heavy) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnDataUsage.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnDataUsage.swift index 5e7d39c6..4778fc25 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnDataUsage.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnDataUsage.swift @@ -13,9 +13,9 @@ import Foundation //----------------------------------------------------- // MARK: - Outlets //------------------------------------------------------- - public let leftLabel = Label.createLabelRegularBodySmall(true) - public let centerLabel = Label.createLabelRegularBodySmall(true) - public let rightLabel = Label.createLabelRegularBodySmall(true) + public let leftLabel = Label(fontStyle: .RegularBodySmall) + public let centerLabel = Label(fontStyle: .RegularBodySmall) + public let rightLabel = Label(fontStyle: .RegularBodySmall) var stack: Stack //------------------------------------------------------ @@ -54,8 +54,8 @@ import Foundation open override func reset() { super.reset() - leftLabel.styleRegularBodySmall(true) - centerLabel.styleRegularBodySmall(true) - rightLabel.styleRegularBodySmall(true) + leftLabel.setFontStyle(.RegularBodySmall) + centerLabel.setFontStyle(.RegularBodySmall) + rightLabel.setFontStyle(.RegularBodySmall) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift index 5fc836d1..721ea270 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift @@ -14,9 +14,9 @@ import Foundation // MARK: - Outlets //----------------------------------------------------- open var stack: Stack - public let leftLabel = Label.createLabelRegularBodySmall(true) - public let centerLabel = Label.createLabelRegularBodySmall(true) - public let rightLabel = Label.createLabelRegularBodySmall(true) + public let leftLabel = Label(fontStyle: .RegularBodySmall) + public let centerLabel = Label(fontStyle: .RegularBodySmall) + public let rightLabel = Label(fontStyle: .RegularBodySmall) public let arrow = Arrow(frame: .zero) public let arrowAndLabel2Stack: Stack @@ -66,8 +66,8 @@ import Foundation open override func reset() { super.reset() - leftLabel.styleRegularBodySmall(true) - centerLabel.styleRegularBodySmall(true) - rightLabel.styleRegularBodySmall(true) + leftLabel.setFontStyle(.RegularBodySmall) + centerLabel.setFontStyle(.RegularBodySmall) + rightLabel.setFontStyle(.RegularBodySmall) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChanges.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChanges.swift index e9a78f1b..8f3cf74e 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChanges.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChanges.swift @@ -13,15 +13,15 @@ import Foundation //------------------------------------------------------- // MARK: - Outlets //------------------------------------------------------- - let leftHeadline1 = Label.createLabelBoldBodySmall(true) - let leftHeadline2 = Label.createLabelBoldBodySmall(true) - let leftHeadline3 = Label.createLabelBoldBodySmall(true) - let leftBody = Label.createLabelRegularBodySmall(true) + let leftHeadline1 = Label(fontStyle: .BoldBodySmall) + let leftHeadline2 = Label(fontStyle: .BoldBodySmall) + let leftHeadline3 = Label(fontStyle: .BoldBodySmall) + let leftBody = Label(fontStyle: .RegularBodySmall) let leftLink = Link() - let rightHeadline1 = Label.createLabelBoldBodySmall(true) - let rightHeadline2 = Label.createLabelBoldBodySmall(true) - let rightHeadline3 = Label.createLabelBoldBodySmall(true) - let rightBody = Label.createLabelRegularBodySmall(true) + let rightHeadline1 = Label(fontStyle: .BoldBodySmall) + let rightHeadline2 = Label(fontStyle: .BoldBodySmall) + let rightHeadline3 = Label(fontStyle: .BoldBodySmall) + let rightBody = Label(fontStyle: .RegularBodySmall) let rightLink = Link() let containingStack: Stack @@ -97,14 +97,14 @@ import Foundation open override func reset() { super.reset() - leftHeadline1.styleBoldBodySmall(true) - leftHeadline2.styleBoldBodySmall(true) - leftHeadline3.styleBoldBodySmall(true) - leftBody.styleRegularBodySmall(true) - rightHeadline1.styleBoldBodySmall(true) - rightHeadline2.styleBoldBodySmall(true) - rightHeadline3.styleBoldBodySmall(true) - rightBody.styleRegularBodySmall(true) + leftHeadline1.setFontStyle(.BoldBodySmall) + leftHeadline2.setFontStyle(.BoldBodySmall) + leftHeadline3.setFontStyle(.BoldBodySmall) + leftBody.setFontStyle(.RegularBodySmall) + rightHeadline1.setFontStyle(.BoldBodySmall) + rightHeadline2.setFontStyle(.BoldBodySmall) + rightHeadline3.setFontStyle(.BoldBodySmall) + rightBody.setFontStyle(.RegularBodySmall) } public override class func estimatedHeight(with molecule: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift index ecae14e8..c0fc2c0f 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift @@ -13,10 +13,10 @@ import Foundation //----------------------------------------------------- // MARK: - Outlets //------------------------------------------------------- - public let leftHeadline = Label.createLabelBoldBodySmall(true) - public let leftBody = Label.createLabelRegularBodySmall(true) - public let rightLabel = Label.createLabelRegularBodySmall(true) - public let rightSubLabel = Label.createLabelRegularBodySmall(true) + public let leftHeadline = Label(fontStyle: .BoldBodySmall) + public let leftBody = Label(fontStyle: .RegularBodySmall) + public let rightLabel = Label(fontStyle: .RegularBodySmall) + public let rightSubLabel = Label(fontStyle: .RegularBodySmall) public let view = MVMCoreUICommonViewsUtility.commonView() public let leftVerticalStack: UIStackView @@ -86,9 +86,9 @@ import Foundation super.reset() leftVerticalStack.reset() rightVerticalStack.reset() - leftHeadline.styleBoldBodySmall(true) - leftBody.styleRegularBodySmall(true) - rightLabel.styleRegularBodySmall(true) - rightSubLabel.styleRegularBodySmall(true) + leftHeadline.setFontStyle(.BoldBodySmall) + leftBody.setFontStyle(.RegularBodySmall) + rightLabel.setFontStyle(.RegularBodySmall) + rightSubLabel.setFontStyle(.RegularBodySmall) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift index 3fbac0f3..263b5e27 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift @@ -10,8 +10,8 @@ import UIKit @objcMembers open class ListTwoColumnPriceDetails: TableViewCell { - let leftLabel = Label.createLabelRegularBodySmall(true) - let rightLabel = Label.createLabelRegularBodySmall(true) + let leftLabel = Label(fontStyle: .RegularBodySmall) + let rightLabel = Label(fontStyle: .RegularBodySmall) let view = MVMCoreUICommonViewsUtility.commonView() // MARK: - MFViewProtocol @@ -44,8 +44,8 @@ import UIKit super.reset() leftLabel.reset() rightLabel.reset() - leftLabel.styleRegularBodySmall(true) - rightLabel.styleRegularBodySmall(true) + leftLabel.setFontStyle(.RegularBodySmall) + rightLabel.setFontStyle(.RegularBodySmall) } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/ListProgressBarData.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/ListProgressBarData.swift index 16b1e93e..848599e2 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/ListProgressBarData.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/ListProgressBarData.swift @@ -14,8 +14,8 @@ import UIKit // MARK: - Outlets //----------------------------------------------------- let progressBar = MultiProgress(frame: .zero) - let leftLabel = Label.createLabelBoldBodySmall(true) - let rightLabel = Label.createLabelBoldBodySmall(true) + let leftLabel = Label(fontStyle: .BoldBodySmall) + let rightLabel = Label(fontStyle: .BoldBodySmall) let view = MVMCoreUICommonViewsUtility.commonView() //----------------------------------------------------- @@ -66,8 +66,8 @@ import UIKit progressBar.reset() leftLabel.reset() rightLabel.reset() - leftLabel.styleBoldBodySmall(true) - rightLabel.styleBoldBodySmall(true) + leftLabel.setFontStyle(.BoldBodySmall) + rightLabel.setFontStyle(.BoldBodySmall) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift index f857b167..63b927c1 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift @@ -11,10 +11,10 @@ import Foundation @objcMembers open class ListFourColumnDataUsageDivider: TableViewCell { // MARK: - MFViewProtocol - let label1 = Label.createLabelBoldBodySmall(true) - let label2 = Label.createLabelBoldBodySmall(true) - let label3 = Label.createLabelBoldBodySmall(true) - let label4 = Label.createLabelBoldBodySmall(true) + let label1 = Label(fontStyle: .BoldBodySmall) + let label2 = Label(fontStyle: .BoldBodySmall) + let label3 = Label(fontStyle: .BoldBodySmall) + let label4 = Label(fontStyle: .BoldBodySmall) var stack: Stack // MARK: - Initializers @@ -55,9 +55,9 @@ import Foundation // MARK: - MoleculeViewProtocol open override func reset() { super.reset() - label1.styleBoldBodySmall(true) - label2.styleBoldBodySmall(true) - label3.styleBoldBodySmall(true) - label4.styleBoldBodySmall(true) + label1.setFontStyle(.BoldBodySmall) + label2.setFontStyle(.BoldBodySmall) + label3.setFontStyle(.BoldBodySmall) + label4.setFontStyle(.BoldBodySmall) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsection.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsection.swift index 18529ebe..f0f91828 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsection.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsection.swift @@ -13,8 +13,8 @@ import Foundation // MARK: - Outlets //----------------------------------------------------- public var stack: Stack - public let headline = Label.createLabelBoldBodySmall(true) - public let body = Label.createLabelRegularBodySmall(true) + public let headline = Label(fontStyle: .BoldBodySmall) + public let body = Label(fontStyle: .BoldBodySmall) // MARK: - Initializers public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { @@ -50,7 +50,7 @@ import Foundation open override func reset() { super.reset() - headline.styleBoldBodySmall(true) - body.styleRegularBodySmall(true) + headline.setFontStyle(.BoldBodySmall) + body.setFontStyle(.RegularBodySmall) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShort.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShort.swift index 3198a72d..7aeeaa15 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShort.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShort.swift @@ -13,8 +13,8 @@ import Foundation // MARK: - Outlets //----------------------------------------------------- public var stack: Stack - public let headline = Label.createLabelBoldTitleMedium(true) - public let body = Label.createLabelRegularBodySmall(true) + public let headline = Label(fontStyle: .BoldTitleMedium) + public let body = Label(fontStyle: .RegularBodySmall) // MARK: - Initializers public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { @@ -50,7 +50,7 @@ import Foundation open override func reset() { super.reset() - headline.styleBoldTitleMedium(true) - body.styleRegularBodySmall(true) + headline.setFontStyle(.BoldTitleMedium) + body.setFontStyle(.RegularBodySmall) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerTall.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerTall.swift index d725ff61..5f5227f9 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerTall.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerTall.swift @@ -13,8 +13,8 @@ import Foundation // MARK: - Outlets //----------------------------------------------------- public var stack: Stack - public let headline = Label.createLabelBoldTitleMedium(true) - public let body = Label.createLabelRegularBodySmall(true) + public let headline = Label(fontStyle: .BoldTitleMedium) + public let body = Label(fontStyle: .RegularBodySmall) // MARK: - Initializers public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { @@ -50,7 +50,7 @@ import Foundation open override func reset() { super.reset() - headline.styleBoldTitleMedium(true) + headline.setFontStyle(.BoldTitleMedium) body.styleRegularBodySmall(true) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnBillChangesDivider.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnBillChangesDivider.swift index a8d80219..876608d8 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnBillChangesDivider.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnBillChangesDivider.swift @@ -9,9 +9,9 @@ import Foundation @objcMembers open class ListThreeColumnBillChangesDivider: TableViewCell { - public let leftLabel = Label.createLabelBoldBodySmall(true) - public let centerLabel = Label.createLabelBoldBodySmall(true) - public let rightLabel = Label.createLabelBoldBodySmall(true) + public let leftLabel = Label(fontStyle: .BoldBodySmall) + public let centerLabel = Label(fontStyle: .BoldBodySmall) + public let rightLabel = Label(fontStyle: .BoldBodySmall) var stack: Stack // MARK: - Initializers @@ -49,8 +49,8 @@ import Foundation open override func reset() { super.reset() - leftLabel.styleBoldBodySmall(true) - centerLabel.styleBoldBodySmall(true) - rightLabel.styleBoldBodySmall(true) + leftLabel.setFontStyle(.BoldBodySmall) + centerLabel.setFontStyle(.BoldBodySmall) + rightLabel.setFontStyle(.BoldBodySmall) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnDataUsageDivider.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnDataUsageDivider.swift index eab5e8be..9393d026 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnDataUsageDivider.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnDataUsageDivider.swift @@ -13,9 +13,9 @@ import Foundation //----------------------------------------------------- // MARK: - Outlets //------------------------------------------------------- - public let leftLabel = Label.createLabelBoldBodySmall(true) - public let centerLabel = Label.createLabelBoldBodySmall(true) - public let rightLabel = Label.createLabelBoldBodySmall(true) + public let leftLabel = Label(fontStyle: .BoldBodySmall) + public let centerLabel = Label(fontStyle: .BoldBodySmall) + public let rightLabel = Label(fontStyle: .BoldBodySmall) var stack: Stack //------------------------------------------------------ @@ -54,8 +54,8 @@ import Foundation open override func reset() { super.reset() - leftLabel.styleBoldBodySmall(true) - centerLabel.styleBoldBodySmall(true) - rightLabel.styleBoldBodySmall(true) + leftLabel.setFontStyle(.BoldBodySmall) + centerLabel.setFontStyle(.BoldBodySmall) + rightLabel.setFontStyle(.BoldBodySmall) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift index 7b6af23d..79a9498d 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift @@ -13,9 +13,9 @@ import Foundation //----------------------------------------------------- // MARK: - Outlets //----------------------------------------------------- - let leftLabel = Label.createLabelBoldBodySmall(true) - let centerLabel = Label.createLabelBoldBodySmall(true) - let rightLabel = Label.createLabelBoldBodySmall(true) + let leftLabel = Label(fontStyle: .BoldBodySmall) + let centerLabel = Label(fontStyle: .BoldBodySmall) + let rightLabel = Label(fontStyle: .BoldBodySmall) var stack: Stack public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { @@ -59,8 +59,8 @@ import Foundation //----------------------------------------------------- override open func reset() { super.reset() - leftLabel.styleBoldBodySmall(true) - centerLabel.styleBoldBodySmall(true) - rightLabel.styleBoldBodySmall(true) + leftLabel.setFontStyle(.BoldBodySmall) + centerLabel.setFontStyle(.BoldBodySmall) + rightLabel.setFontStyle(.BoldBodySmall) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnSpeedTestDivider.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnSpeedTestDivider.swift index aa9fbc2d..cb622256 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnSpeedTestDivider.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnSpeedTestDivider.swift @@ -13,9 +13,9 @@ import Foundation //------------------------------------------------------- // MARK: - Outlets //------------------------------------------------------- - let leftLabel = Label.createLabelBoldBodySmall(true) - let centerLabel = Label.createLabelBoldBodySmall(true) - let rightLabel = Label.createLabelBoldBodySmall(true) + let leftLabel = Label(fontStyle: .BoldBodySmall) + let centerLabel = Label(fontStyle: .BoldBodySmall) + let rightLabel = Label(fontStyle: .BoldBodySmall) var stack: Stack //------------------------------------------------------- @@ -56,8 +56,8 @@ import Foundation open override func reset() { super.reset() - leftLabel.styleBoldBodySmall(true) - centerLabel.styleBoldBodySmall(true) - rightLabel.styleBoldBodySmall(true) + leftLabel.setFontStyle(.BoldBodySmall) + centerLabel.setFontStyle(.BoldBodySmall) + rightLabel.setFontStyle(.BoldBodySmall) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnSubsectionDivider.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnSubsectionDivider.swift index d26da0f4..2b46daae 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnSubsectionDivider.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnSubsectionDivider.swift @@ -13,8 +13,8 @@ import Foundation //-------------------------------------------------- // MARK: - Outlets //-------------------------------------------------- - let leftLabel = Label.createLabelBoldBodySmall(true) - let rightLabel = Label.createLabelBoldBodySmall(true) + let leftLabel = Label(fontStyle: .BoldBodySmall) + let rightLabel = Label(fontStyle: .BoldBodySmall) var stack: Stack //------------------------------------------------------- @@ -56,7 +56,7 @@ import Foundation open override func reset() { super.reset() - leftLabel.styleBoldBodySmall(true) - rightLabel.styleBoldBodySmall(true) + leftLabel.setFontStyle(.BoldBodySmall) + rightLabel.setFontStyle(.BoldBodySmall) } } diff --git a/MVMCoreUI/Atomic/Molecules/Doughnut/ColorViewWithLabel.swift b/MVMCoreUI/Atomic/Molecules/Doughnut/ColorViewWithLabel.swift index f8dd4b5c..b9b3a4a4 100644 --- a/MVMCoreUI/Atomic/Molecules/Doughnut/ColorViewWithLabel.swift +++ b/MVMCoreUI/Atomic/Molecules/Doughnut/ColorViewWithLabel.swift @@ -14,7 +14,7 @@ open class ColorViewWithLabel: View { // MARK: - Properties //-------------------------------------------------- - public var label = Label.createLabelRegularBodySmall(true) + public var label = Label(fontStyle: .RegularBodySmall, true) public var colorView = View() private var sizeObject = MFStyler.sizeObjectGeneric(forCurrentDevice: 8)! diff --git a/MVMCoreUI/Atomic/Molecules/Doughnut/DoughnutChart.swift b/MVMCoreUI/Atomic/Molecules/Doughnut/DoughnutChart.swift index bad0492d..649c9c5e 100644 --- a/MVMCoreUI/Atomic/Molecules/Doughnut/DoughnutChart.swift +++ b/MVMCoreUI/Atomic/Molecules/Doughnut/DoughnutChart.swift @@ -15,8 +15,8 @@ open class DoughnutChart: View { //-------------------------------------------------- public var doughnutLayer = CALayer() - public var titleLabel = Label.createLabelBoldTitleLarge(true) - public var subTitleLabel = Label.createLabelRegularMicro(true) + public var titleLabel = Label(fontStyle: .BoldTitleLarge, true) + public var subTitleLabel = Label(fontStyle: .RegularMicro, true) public var labelContainer = MVMCoreUICommonViewsUtility.commonView() public static let heightConstant: CGFloat = 136 private var sizeObject = MFStyler.sizeObjectGeneric(forCurrentDevice: heightConstant)! diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/ImageHeadlineBody.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/ImageHeadlineBody.swift index ff770da3..6f2e1960 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/ImageHeadlineBody.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/ImageHeadlineBody.swift @@ -18,7 +18,7 @@ import UIKit open override func setupView() { super.setupView() - headlineBody.headlineLabel.styleBoldBodySmall(true) + headlineBody.headlineLabel.setFontStyle(.BoldBodySmall) headlineBody.spaceBetweenLabelsConstant = 0 imageView.addSizeConstraintsForAspectRatio = true @@ -43,7 +43,7 @@ import UIKit open override func reset() { super.reset() headlineBody.reset() - headlineBody.headlineLabel.styleBoldBodySmall(true) + headlineBody.headlineLabel.setFontStyle(.BoldBodySmall) headlineBody.spaceBetweenLabelsConstant = 0 imageView.reset() } diff --git a/MVMCoreUI/Atomic/Molecules/LeftRightViews/CornerLabels.swift b/MVMCoreUI/Atomic/Molecules/LeftRightViews/CornerLabels.swift index 5751fbc2..be3ac62e 100644 --- a/MVMCoreUI/Atomic/Molecules/LeftRightViews/CornerLabels.swift +++ b/MVMCoreUI/Atomic/Molecules/LeftRightViews/CornerLabels.swift @@ -10,10 +10,10 @@ import UIKit @objcMembers public class CornerLabels: View { var middleView: UIView? - let topLeftLabel = Label.createLabelBoldBodySmall(true) - let topRightLabel = Label.createLabelBoldBodySmall(true) - let bottomLeftLabel = Label.createLabelRegularMicro(true) - let bottomRightLabel = Label.createLabelRegularMicro(true) + let topLeftLabel = Label(fontStyle: .BoldBodySmall) + let topRightLabel = Label(fontStyle: .BoldBodySmall) + let bottomLeftLabel = Label(fontStyle: .RegularMicro) + let bottomRightLabel = Label(fontStyle: .RegularMicro) let topLabelsView = MVMCoreUICommonViewsUtility.commonView() let bottomLabelsView = MVMCoreUICommonViewsUtility.commonView() @@ -151,10 +151,10 @@ import UIKit } func styleDefault() { - topLeftLabel.styleBoldBodySmall(true) - topRightLabel.styleBoldBodySmall(true) - bottomLeftLabel.styleRegularMicro(true) - bottomRightLabel.styleRegularMicro(true) + topLeftLabel.setFontStyle(.BoldBodySmall) + topRightLabel.setFontStyle(.BoldBodySmall) + bottomLeftLabel.setFontStyle(.RegularMicro) + bottomRightLabel.setFontStyle(.RegularMicro) } public class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { diff --git a/MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/LabelToggle.swift b/MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/LabelToggle.swift index 3ff3a41f..5611984f 100644 --- a/MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/LabelToggle.swift +++ b/MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/LabelToggle.swift @@ -14,7 +14,7 @@ import UIKit // MARK: - Properties //-------------------------------------------------- - public let label = Label.createLabelBoldBodySmall(true) + public let label = Label(fontStyle: .BoldBodySmall) public let toggle = Toggle() //-------------------------------------------------- @@ -58,6 +58,6 @@ import UIKit super.reset() label.reset() toggle.reset() - label.styleBoldBodySmall(true) + label.setFontStyle(.BoldBodySmall) } } diff --git a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift index 9ad26015..67a56291 100644 --- a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift @@ -14,9 +14,9 @@ import UIKit //-------------------------------------------------- public let stack = Stack(frame: .zero) - public let eyebrow = Label.createLabelRegularMicro(true) - public let headline = Label.createLabelBoldBodySmall(true) - public let body = Label.createLabelRegularBodySmall(true) + public let eyebrow = Label(fontStyle: .RegularMicro) + public let headline = Label(fontStyle: .BoldBodySmall) + public let body = Label(fontStyle: .RegularBodySmall, true) public let link = Link() var castModel: EyebrowHeadlineBodyLinkModel? { @@ -48,9 +48,9 @@ import UIKit open override func reset() { super.reset() stack.reset() - eyebrow.styleRegularMicro(true) - headline.styleBoldBodySmall(true) - body.styleRegularBodySmall(true) + eyebrow.setFontStyle(.RegularMicro) + headline.setFontStyle(.RegularMicro) + body.setFontStyle(.RegularBodySmall) } //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBody.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBody.swift index 4e9b97dd..93b6fa68 100644 --- a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBody.swift +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBody.swift @@ -10,8 +10,8 @@ import UIKit open class HeadlineBody: View { - let headlineLabel = Label.createLabelBoldTitleLarge(true) - let messageLabel = Label.createLabelRegularBodySmall(true) + let headlineLabel = Label(fontStyle: .BoldTitleLarge) + let messageLabel = Label(fontStyle: .RegularBodySmall) var spaceBetweenLabelsConstant = PaddingOne var spaceBetweenLabels: NSLayoutConstraint? var leftConstraintTitle: NSLayoutConstraint? @@ -39,26 +39,26 @@ open class HeadlineBody: View { } func styleLandingPageHeader() { - headlineLabel.styleTitle2XLarge(true) - messageLabel.styleRegularBodySmall(true) + headlineLabel.setFontStyle(.Title2XLarge) + messageLabel.setFontStyle(.RegularBodySmall) spaceBetweenLabelsConstant = PaddingTwo } func stylePageHeader() { - headlineLabel.styleBoldTitleLarge(true) - messageLabel.styleRegularBodySmall(true) + headlineLabel.setFontStyle(.BoldTitleLarge) + messageLabel.setFontStyle(.RegularBodySmall) spaceBetweenLabelsConstant = PaddingOne } func styleListItem() { - headlineLabel.styleBoldBodySmall(true) - messageLabel.styleRegularBodySmall(true) + headlineLabel.setFontStyle(.BoldBodySmall) + messageLabel.setFontStyle(.RegularBodySmall) spaceBetweenLabelsConstant = 0 } func styleListItemDivider() { - headlineLabel.styleBoldTitleMedium(true) - messageLabel.styleRegularBodySmall(true) + headlineLabel.setFontStyle(.BoldTitleMedium) + messageLabel.setFontStyle(.RegularBodySmall) spaceBetweenLabelsConstant = 0 } diff --git a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeView.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeView.swift index 30a82134..3c97e988 100644 --- a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeView.swift +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeView.swift @@ -9,7 +9,7 @@ import Foundation open class StringAndMoleculeView: View { - var label = Label.createLabelRegularBodySmall(true) + var label = Label(fontStyle: .RegularBodySmall) var molecule: MoleculeViewProtocol var leftWidthConstraint: NSLayoutConstraint? From 6f23ee6c9940f17e49deea186433d5ccc45af5c1 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Fri, 5 Jun 2020 09:43:51 -0400 Subject: [PATCH 31/44] comments and code removal --- .../Atomic/Atoms/Views/Label/Label.swift | 72 ++----------------- ...eColumnTextWithWhitespaceDividerTall.swift | 2 +- .../EyebrowHeadlineBodyLink.swift | 2 +- 3 files changed, 9 insertions(+), 67 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift index 14250f30..abc37c43 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift @@ -147,7 +147,7 @@ public typealias ActionBlock = () -> () } //------------------------------------------------------ - // MARK: - Factory Functions + // MARK: - 2.0 Factory Functions //------------------------------------------------------ //2.0 fonts init methods @@ -495,7 +495,7 @@ public typealias ActionBlock = () -> () } //------------------------------------------------------ - // MARK: - Methods + // MARK: - 3.0 Styling Method //------------------------------------------------------ public func setFontStyle(_ fontStyle: Styler.Font, _ scale: Bool = true) { @@ -503,69 +503,11 @@ public typealias ActionBlock = () -> () textColor = .mvmBlack setScale(scale) } - - //mva 3.0 font - @objc public func styleTitle2XLarge(_ scale: Bool) { - MFStyler.styleLabelTitle2XLarge(self, genericScaling: false) - setScale(scale) - } - - @objc public func styleTitleXLarge(_ scale: Bool) { - MFStyler.styleLabelTitleXLarge(self, genericScaling: false) - setScale(scale) - } - - @objc public func styleBoldTitleLarge(_ scale: Bool) { - MFStyler.styleLabelBoldTitleLarge(self, genericScaling: false) - setScale(scale) - } - - @objc public func styleRegularTitleLarge(_ scale: Bool) { - MFStyler.styleLabelRegularTitleLarge(self, genericScaling: false) - setScale(scale) - } - - @objc public func styleBoldTitleMedium(_ scale: Bool) { - MFStyler.styleLabelBoldTitleMedium(self, genericScaling: false) - setScale(scale) - } - - @objc public func styleRegularTitleMedium(_ scale: Bool) { - MFStyler.styleLabelRegularTitleMedium(self, genericScaling: false) - setScale(scale) - } - - @objc public func styleBoldBodyLarge(_ scale: Bool) { - MFStyler.styleLabelBoldBodyLarge(self, genericScaling: false) - setScale(scale) - } - - @objc public func styleRegularBodyLarge(_ scale: Bool) { - MFStyler.styleLabelRegularBodyLarge(self, genericScaling: false) - setScale(scale) - } - - @objc public func styleBoldBodySmall(_ scale: Bool) { - MFStyler.styleLabelBoldBodySmall(self, genericScaling: false) - setScale(scale) - } - - @objc public func styleRegularBodySmall(_ scale: Bool) { - MFStyler.styleLabelRegularBodySmall(self, genericScaling: false) - setScale(scale) - } - - @objc public func styleBoldMicro(_ scale: Bool) { - MFStyler.styleLabelBoldMicro(self, genericScaling: false) - setScale(scale) - } - - @objc public func styleRegularMicro(_ scale: Bool) { - MFStyler.styleLabelRegularMicro(self, genericScaling: false) - setScale(scale) - } - - //2.0 fonts + + //------------------------------------------------------ + // MARK: - 2.0 Styling Methods + //------------------------------------------------------ + @objc public func styleH1(_ scale: Bool) { MFStyler.styleLabelH1(self, genericScaling: false) setScale(scale) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerTall.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerTall.swift index 5f5227f9..e0182f05 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerTall.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerTall.swift @@ -51,6 +51,6 @@ import Foundation open override func reset() { super.reset() headline.setFontStyle(.BoldTitleMedium) - body.styleRegularBodySmall(true) + body.setFontStyle(.RegularBodySmall) } } diff --git a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift index 67a56291..7d176ba2 100644 --- a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift @@ -49,7 +49,7 @@ import UIKit super.reset() stack.reset() eyebrow.setFontStyle(.RegularMicro) - headline.setFontStyle(.RegularMicro) + headline.setFontStyle(.BoldBodySmall) body.setFontStyle(.RegularBodySmall) } From 72fa1fe9cdcfe84f222b4e93fef4519bd536d48b Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 5 Jun 2020 12:19:21 -0400 Subject: [PATCH 32/44] minor cleaning --- MVMCoreUI.xcodeproj/project.pbxproj | 42 +++++++++++++------ .../{Selectors => FormFields/Tags}/Tag.swift | 6 +++ .../Tags}/TagCollectionViewCell.swift | 0 .../Tags}/TagModel.swift | 0 .../Tags/Tags.swift} | 20 ++++----- .../Tags/TagsModel.swift} | 8 ++-- .../TextFields/BaseDropdownEntryField.swift | 0 .../BaseDropdownEntryFieldModel.swift | 0 .../TextFields/DateDropdownEntryField.swift | 0 .../DateDropdownEntryFieldModel.swift | 0 .../TextFields/DigitBox.swift | 0 .../TextFields/DigitEntryField.swift | 0 .../TextFields/DigitEntryFieldModel.swift | 0 .../TextFields/EntryField.swift | 0 .../TextFields/EntryFieldModel.swift | 0 .../TextFields/ItemDropdownEntryField.swift | 0 .../ItemDropdownEntryFieldModel.swift | 0 .../TextFields/MdnEntryField.swift | 0 .../TextFields/MdnEntryFieldModel.swift | 0 .../TextFields/TextEntryField.swift | 0 .../TextFields/TextEntryFieldModel.swift | 0 .../TextFields/TextViewEntryField.swift | 0 .../TextFields/TextViewEntryFieldModel.swift | 0 MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 2 +- 24 files changed, 48 insertions(+), 30 deletions(-) rename MVMCoreUI/Atomic/Atoms/{Selectors => FormFields/Tags}/Tag.swift (90%) rename MVMCoreUI/Atomic/Atoms/{Selectors => FormFields/Tags}/TagCollectionViewCell.swift (100%) rename MVMCoreUI/Atomic/Atoms/{Selectors => FormFields/Tags}/TagModel.swift (100%) rename MVMCoreUI/Atomic/Atoms/{Selectors/TagsList.swift => FormFields/Tags/Tags.swift} (87%) rename MVMCoreUI/Atomic/Atoms/{Selectors/TagsListModel.swift => FormFields/Tags/TagsModel.swift} (85%) rename MVMCoreUI/Atomic/Atoms/{ => FormFields}/TextFields/BaseDropdownEntryField.swift (100%) rename MVMCoreUI/Atomic/Atoms/{ => FormFields}/TextFields/BaseDropdownEntryFieldModel.swift (100%) rename MVMCoreUI/Atomic/Atoms/{ => FormFields}/TextFields/DateDropdownEntryField.swift (100%) rename MVMCoreUI/Atomic/Atoms/{ => FormFields}/TextFields/DateDropdownEntryFieldModel.swift (100%) rename MVMCoreUI/Atomic/Atoms/{ => FormFields}/TextFields/DigitBox.swift (100%) rename MVMCoreUI/Atomic/Atoms/{ => FormFields}/TextFields/DigitEntryField.swift (100%) rename MVMCoreUI/Atomic/Atoms/{ => FormFields}/TextFields/DigitEntryFieldModel.swift (100%) rename MVMCoreUI/Atomic/Atoms/{ => FormFields}/TextFields/EntryField.swift (100%) rename MVMCoreUI/Atomic/Atoms/{ => FormFields}/TextFields/EntryFieldModel.swift (100%) rename MVMCoreUI/Atomic/Atoms/{ => FormFields}/TextFields/ItemDropdownEntryField.swift (100%) rename MVMCoreUI/Atomic/Atoms/{ => FormFields}/TextFields/ItemDropdownEntryFieldModel.swift (100%) rename MVMCoreUI/Atomic/Atoms/{ => FormFields}/TextFields/MdnEntryField.swift (100%) rename MVMCoreUI/Atomic/Atoms/{ => FormFields}/TextFields/MdnEntryFieldModel.swift (100%) rename MVMCoreUI/Atomic/Atoms/{ => FormFields}/TextFields/TextEntryField.swift (100%) rename MVMCoreUI/Atomic/Atoms/{ => FormFields}/TextFields/TextEntryFieldModel.swift (100%) rename MVMCoreUI/Atomic/Atoms/{ => FormFields}/TextFields/TextViewEntryField.swift (100%) rename MVMCoreUI/Atomic/Atoms/{ => FormFields}/TextFields/TextViewEntryFieldModel.swift (100%) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 0369c673..2521b6d2 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -221,8 +221,8 @@ BB2C968F24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */; }; BB2C969224330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2C969124330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift */; }; BB2FB3BB247E7EBC00DF73CD /* TagCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3BA247E7EBC00DF73CD /* TagCollectionViewCell.swift */; }; - BB2FB3BD247E7EF200DF73CD /* TagsList.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3BC247E7EF200DF73CD /* TagsList.swift */; }; - BB2FB3BF247E7F0900DF73CD /* TagsListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3BE247E7F0900DF73CD /* TagsListModel.swift */; }; + BB2FB3BD247E7EF200DF73CD /* Tags.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3BC247E7EF200DF73CD /* Tags.swift */; }; + BB2FB3BF247E7F0900DF73CD /* TagsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3BE247E7F0900DF73CD /* TagsModel.swift */; }; BB47A586241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */; }; BB47A588241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift */; }; BB54C5202434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB54C51E2434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift */; }; @@ -664,8 +664,8 @@ BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableTextLinkAllTextAndLinksModel.swift; sourceTree = ""; }; BB2C969124330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableTextLinkAllTextAndLinks.swift; sourceTree = ""; }; BB2FB3BA247E7EBC00DF73CD /* TagCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagCollectionViewCell.swift; sourceTree = ""; }; - BB2FB3BC247E7EF200DF73CD /* TagsList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagsList.swift; sourceTree = ""; }; - BB2FB3BE247E7F0900DF73CD /* TagsListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagsListModel.swift; sourceTree = ""; }; + BB2FB3BC247E7EF200DF73CD /* Tags.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tags.swift; sourceTree = ""; }; + BB2FB3BE247E7F0900DF73CD /* TagsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagsModel.swift; sourceTree = ""; }; BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsectionModel.swift; sourceTree = ""; }; BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsection.swift; sourceTree = ""; }; BB54C51E2434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableButtonAllTextAndLinks.swift; sourceTree = ""; }; @@ -1456,12 +1456,6 @@ D264FAA8243FE17A00D98315 /* Selectors */ = { isa = PBXGroup; children = ( - BB2FB3BE247E7F0900DF73CD /* TagsListModel.swift */, - BB2FB3BC247E7EF200DF73CD /* TagsList.swift */, - BB258D36248A259000125E9D /* UICollectionViewLeftAlignedLayout.swift */, - BBC0C4FE24811DCA0087C44F /* TagModel.swift */, - BBC0C4FC24811DBC0087C44F /* Tag.swift */, - BB2FB3BA247E7EBC00DF73CD /* TagCollectionViewCell.swift */, D264FAAB2441009400D98315 /* RadioBoxCollectionViewCell.swift */, BBAA4F01243D8E3B005AAD5F /* RadioBoxesModel.swift */, BBAA4EFF243D8E3B005AAD5F /* RadioBoxes.swift */, @@ -1561,8 +1555,8 @@ D29DF10D21E67A70003B2FB9 /* Atoms */ = { isa = PBXGroup; children = ( + D2BEFEF5248A954C00FAB3A9 /* FormFields */, D264FAA8243FE17A00D98315 /* Selectors */, - D29DF22B21E6A0FA003B2FB9 /* TextFields */, D29DF17D21E69E26003B2FB9 /* Views */, D29DF16821E69E1F003B2FB9 /* Buttons */, ); @@ -1875,6 +1869,7 @@ D20923582450ECE00044AD09 /* TableView.swift */, D2755D7A23689C7500485468 /* TableViewCell.swift */, D21B7F70243BAC1600051ABF /* CollectionViewCell.swift */, + BB258D36248A259000125E9D /* UICollectionViewLeftAlignedLayout.swift */, D264FAA92440F97600D98315 /* CollectionView.swift */, 0A5D59C323AD488600EFD9E9 /* Protocols */, 0A7918F423F5E7EA00772FF4 /* ImageView.swift */, @@ -1883,6 +1878,27 @@ path = BaseClasses; sourceTree = ""; }; + D2BEFEF5248A954C00FAB3A9 /* FormFields */ = { + isa = PBXGroup; + children = ( + D2BEFEF6248A957A00FAB3A9 /* Tags */, + D29DF22B21E6A0FA003B2FB9 /* TextFields */, + ); + path = FormFields; + sourceTree = ""; + }; + D2BEFEF6248A957A00FAB3A9 /* Tags */ = { + isa = PBXGroup; + children = ( + BBC0C4FE24811DCA0087C44F /* TagModel.swift */, + BBC0C4FC24811DBC0087C44F /* Tag.swift */, + BB2FB3BE247E7F0900DF73CD /* TagsModel.swift */, + BB2FB3BC247E7EF200DF73CD /* Tags.swift */, + BB2FB3BA247E7EBC00DF73CD /* TagCollectionViewCell.swift */, + ); + path = Tags; + sourceTree = ""; + }; D2C78CD324252F4E00B69FDE /* Atomic */ = { isa = PBXGroup; children = ( @@ -2154,7 +2170,7 @@ D2755D7B23689C7500485468 /* TableViewCell.swift in Sources */, 0A25209624645AFD000FA9F6 /* TextViewEntryField.swift in Sources */, 014AA72623C501E2006F3E93 /* ContainerModelProtocol.swift in Sources */, - BB2FB3BF247E7F0900DF73CD /* TagsListModel.swift in Sources */, + BB2FB3BF247E7F0900DF73CD /* TagsModel.swift in Sources */, AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */, 011D9626240EBB16000E3791 /* RadioButtonLabelModel.swift in Sources */, 8DDD6C1D244D90B8006A2232 /* ListThreeColumnDataUsage.swift in Sources */, @@ -2292,7 +2308,7 @@ D253BB9E2458751F002DE544 /* BGImageMoleculeModel.swift in Sources */, 0ABD1371237DB0450081388D /* ItemDropdownEntryField.swift in Sources */, 8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */, - BB2FB3BD247E7EF200DF73CD /* TagsList.swift in Sources */, + BB2FB3BD247E7EF200DF73CD /* Tags.swift in Sources */, BBAA4F03243D8E3B005AAD5F /* RadioBoxes.swift in Sources */, D2E1FAE12268E81D00AEFD8C /* MoleculeListTemplate.swift in Sources */, 525019E72406853600EED91C /* ListFourColumnDataUsageDivider.swift in Sources */, diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/Tag.swift b/MVMCoreUI/Atomic/Atoms/FormFields/Tags/Tag.swift similarity index 90% rename from MVMCoreUI/Atomic/Atoms/Selectors/Tag.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/Tags/Tag.swift index 1080c7a9..c962f8c9 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/Tag.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/Tags/Tag.swift @@ -32,4 +32,10 @@ import Foundation super.updateView(size) label.updateView(size) } + + open override func reset() { + super.reset() + label.reset() + label.styleRegularBodySmall(true) + } } diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagCollectionViewCell.swift b/MVMCoreUI/Atomic/Atoms/FormFields/Tags/TagCollectionViewCell.swift similarity index 100% rename from MVMCoreUI/Atomic/Atoms/Selectors/TagCollectionViewCell.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/Tags/TagCollectionViewCell.swift diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagModel.swift b/MVMCoreUI/Atomic/Atoms/FormFields/Tags/TagModel.swift similarity index 100% rename from MVMCoreUI/Atomic/Atoms/Selectors/TagModel.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/Tags/TagModel.swift diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift b/MVMCoreUI/Atomic/Atoms/FormFields/Tags/Tags.swift similarity index 87% rename from MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/Tags/Tags.swift index 5a30f597..bbb5502a 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/TagsList.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/Tags/Tags.swift @@ -1,5 +1,5 @@ // -// TagsList.swift +// Tags.swift // MVMCoreUI // // Created by Dhamodaram Nandi on 27/05/20. @@ -8,12 +8,11 @@ import Foundation -open class TagsList: View,MFButtonProtocol { - +open class Tags: View, MFButtonProtocol { public var collectionView: CollectionView! public var collectionViewHeight: NSLayoutConstraint! - private var tagsListModel: TagsListModel? { - return model as? TagsListModel + private var tagsListModel: TagsModel? { + return model as? TagsModel } private var delegateObject: MVMCoreUIDelegateObject? @@ -27,7 +26,6 @@ open class TagsList: View,MFButtonProtocol { DispatchQueue.main.async { self.collectionView.collectionViewLayout.invalidateLayout() self.collectionViewHeight.constant = self.collectionView.contentSize.height - self.collectionViewHeight.isActive = true self.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self) } } @@ -46,7 +44,7 @@ open class TagsList: View,MFButtonProtocol { open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { super.set(with: model, delegateObject, additionalData) self.delegateObject = delegateObject - guard let tagsListModel = model as? TagsListModel else { return } + guard let tagsListModel = model as? TagsModel else { return } tags = tagsListModel.tags registerCells() collectionView.reloadData() @@ -61,7 +59,6 @@ open class TagsList: View,MFButtonProtocol { /// Creates the layout for the collection. open func createCollectionViewLayout() -> UICollectionViewLayout { let layout = UICollectionViewLeftAlignedLayout() - layout.scrollDirection = .vertical layout.estimatedItemSize = CGSize(width: 140, height: 40) layout.minimumLineSpacing = 24.0 return layout @@ -81,7 +78,7 @@ open class TagsList: View,MFButtonProtocol { } } -extension TagsList: UICollectionViewDataSource { +extension Tags: UICollectionViewDataSource { open func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return tags?.count ?? 0 } @@ -98,9 +95,10 @@ extension TagsList: UICollectionViewDataSource { } } -extension TagsList: UICollectionViewDelegate { +extension Tags: UICollectionViewDelegate { open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - guard let tagModel = tags?[indexPath.row], let tagAction = tagModel.action else {return} + guard let tagModel = tags?[indexPath.row], + let tagAction = tagModel.action else { return } Button.performButtonAction(with: tagAction, button: self, delegateObject: delegateObject, additionalData: nil) } } diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift b/MVMCoreUI/Atomic/Atoms/FormFields/Tags/TagsModel.swift similarity index 85% rename from MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/Tags/TagsModel.swift index 86de5206..009f8fa1 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/TagsListModel.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/Tags/TagsModel.swift @@ -1,5 +1,5 @@ // -// TagsListModel.swift +// TagsModel.swift // MVMCoreUI // // Created by Dhamodaram Nandi on 27/05/20. @@ -8,17 +8,15 @@ import Foundation -@objcMembers public class TagsListModel: MoleculeModelProtocol { - +@objcMembers public class TagsModel: MoleculeModelProtocol { + public static var identifier: String = "tags" public var backgroundColor: Color? - public static var identifier: String = "tagsList" public var tags: [TagModel] private enum CodingKeys: String, CodingKey { case moleculeName case backgroundColor case tags - case height } required public init(from decoder: Decoder) throws { diff --git a/MVMCoreUI/Atomic/Atoms/TextFields/BaseDropdownEntryField.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/BaseDropdownEntryField.swift similarity index 100% rename from MVMCoreUI/Atomic/Atoms/TextFields/BaseDropdownEntryField.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/TextFields/BaseDropdownEntryField.swift diff --git a/MVMCoreUI/Atomic/Atoms/TextFields/BaseDropdownEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/BaseDropdownEntryFieldModel.swift similarity index 100% rename from MVMCoreUI/Atomic/Atoms/TextFields/BaseDropdownEntryFieldModel.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/TextFields/BaseDropdownEntryFieldModel.swift diff --git a/MVMCoreUI/Atomic/Atoms/TextFields/DateDropdownEntryField.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DateDropdownEntryField.swift similarity index 100% rename from MVMCoreUI/Atomic/Atoms/TextFields/DateDropdownEntryField.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DateDropdownEntryField.swift diff --git a/MVMCoreUI/Atomic/Atoms/TextFields/DateDropdownEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DateDropdownEntryFieldModel.swift similarity index 100% rename from MVMCoreUI/Atomic/Atoms/TextFields/DateDropdownEntryFieldModel.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DateDropdownEntryFieldModel.swift diff --git a/MVMCoreUI/Atomic/Atoms/TextFields/DigitBox.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DigitBox.swift similarity index 100% rename from MVMCoreUI/Atomic/Atoms/TextFields/DigitBox.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DigitBox.swift diff --git a/MVMCoreUI/Atomic/Atoms/TextFields/DigitEntryField.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DigitEntryField.swift similarity index 100% rename from MVMCoreUI/Atomic/Atoms/TextFields/DigitEntryField.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DigitEntryField.swift diff --git a/MVMCoreUI/Atomic/Atoms/TextFields/DigitEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DigitEntryFieldModel.swift similarity index 100% rename from MVMCoreUI/Atomic/Atoms/TextFields/DigitEntryFieldModel.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DigitEntryFieldModel.swift diff --git a/MVMCoreUI/Atomic/Atoms/TextFields/EntryField.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/EntryField.swift similarity index 100% rename from MVMCoreUI/Atomic/Atoms/TextFields/EntryField.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/TextFields/EntryField.swift diff --git a/MVMCoreUI/Atomic/Atoms/TextFields/EntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/EntryFieldModel.swift similarity index 100% rename from MVMCoreUI/Atomic/Atoms/TextFields/EntryFieldModel.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/TextFields/EntryFieldModel.swift diff --git a/MVMCoreUI/Atomic/Atoms/TextFields/ItemDropdownEntryField.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/ItemDropdownEntryField.swift similarity index 100% rename from MVMCoreUI/Atomic/Atoms/TextFields/ItemDropdownEntryField.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/TextFields/ItemDropdownEntryField.swift diff --git a/MVMCoreUI/Atomic/Atoms/TextFields/ItemDropdownEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/ItemDropdownEntryFieldModel.swift similarity index 100% rename from MVMCoreUI/Atomic/Atoms/TextFields/ItemDropdownEntryFieldModel.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/TextFields/ItemDropdownEntryFieldModel.swift diff --git a/MVMCoreUI/Atomic/Atoms/TextFields/MdnEntryField.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/MdnEntryField.swift similarity index 100% rename from MVMCoreUI/Atomic/Atoms/TextFields/MdnEntryField.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/TextFields/MdnEntryField.swift diff --git a/MVMCoreUI/Atomic/Atoms/TextFields/MdnEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/MdnEntryFieldModel.swift similarity index 100% rename from MVMCoreUI/Atomic/Atoms/TextFields/MdnEntryFieldModel.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/TextFields/MdnEntryFieldModel.swift diff --git a/MVMCoreUI/Atomic/Atoms/TextFields/TextEntryField.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextEntryField.swift similarity index 100% rename from MVMCoreUI/Atomic/Atoms/TextFields/TextEntryField.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextEntryField.swift diff --git a/MVMCoreUI/Atomic/Atoms/TextFields/TextEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextEntryFieldModel.swift similarity index 100% rename from MVMCoreUI/Atomic/Atoms/TextFields/TextEntryFieldModel.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextEntryFieldModel.swift diff --git a/MVMCoreUI/Atomic/Atoms/TextFields/TextViewEntryField.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryField.swift similarity index 100% rename from MVMCoreUI/Atomic/Atoms/TextFields/TextViewEntryField.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryField.swift diff --git a/MVMCoreUI/Atomic/Atoms/TextFields/TextViewEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryFieldModel.swift similarity index 100% rename from MVMCoreUI/Atomic/Atoms/TextFields/TextViewEntryFieldModel.swift rename to MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryFieldModel.swift diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index b95d0d40..665a9919 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -73,7 +73,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: RadioBoxes.self, viewModelClass: RadioBoxesModel.self) MoleculeObjectMapping.shared()?.register(viewClass: Checkbox.self, viewModelClass: CheckboxModel.self) MoleculeObjectMapping.shared()?.register(viewClass: RadioSwatches.self, viewModelClass: RadioSwatchesModel.self) - MoleculeObjectMapping.shared()?.register(viewClass: TagsList.self, viewModelClass: TagsListModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: Tags.self, viewModelClass: TagsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: Tag.self, viewModelClass: TagModel.self) From e90bf7c9dbd1beb2835db98da2910f83a0631ca3 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 5 Jun 2020 16:23:11 -0400 Subject: [PATCH 33/44] Catch error for debugging --- MVMCoreUI/Containers/NavigationController.swift | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Containers/NavigationController.swift b/MVMCoreUI/Containers/NavigationController.swift index bac5817c..8e7279ce 100644 --- a/MVMCoreUI/Containers/NavigationController.swift +++ b/MVMCoreUI/Containers/NavigationController.swift @@ -92,9 +92,13 @@ import UIKit } /// Convenience setter for legacy files - public static func set(navigationController: UINavigationController, navigationJSON: [String: Any], viewController: UIViewController) { - let moleculeName = ModelRegistry.getType(for: navigationJSON.stringForkey(KeyMoleculeName), with: MoleculeModelProtocol.self) - guard let barModel = try? moleculeName?.decode(jsonDict: navigationJSON) as? (MoleculeModelProtocol & NavigationItemModelProtocol) else { return } + public static func set(navigationController: UINavigationController, navigationJSON: [String: Any], viewController: UIViewController) throws { + guard let moleculeName = ModelRegistry.getType(for: navigationJSON.stringForkey(KeyMoleculeName), with: MoleculeModelProtocol.self) else { + throw ModelRegistry.Error.keyNotFound + } + guard let barModel = try moleculeName.decode(jsonDict: navigationJSON) as? (MoleculeModelProtocol & NavigationItemModelProtocol) else { + throw ModelRegistry.Error.decoderOther(message: "Model not a bar model") + } set(navigationController: navigationController, navigationItemModel: barModel, viewController: viewController) } } From fd3f3ea627c29cab7422fcfe4f23538e1155b697 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 5 Jun 2020 16:34:14 -0400 Subject: [PATCH 34/44] Convenience function --- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 12 ++++++++++++ MVMCoreUI/Containers/NavigationController.swift | 5 +---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index ce86fc26..4f151642 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -34,6 +34,18 @@ import Foundation return type.init(model: model, delegateObject, additionalData) } + /// Convenience function for legacy classes + public func getMoleculeModelForJSON(_ json: [String: Any]) throws -> MoleculeModelProtocol? { + guard let moleculeName = json.optionalStringForKey(KeyMoleculeName), + let type = ModelRegistry.getType(for: moleculeName, with: MoleculeModelProtocol.self) else { + throw ModelRegistry.Error.decoderErrorModelNotMapped + } + guard let model = try type.decode(jsonDict: json) as? MoleculeModelProtocol else { + throw ModelRegistry.Error.decoderError + } + return model + } + /// Call to register all of the CoreUI molecules. public static func registerObjects() { // Stacks diff --git a/MVMCoreUI/Containers/NavigationController.swift b/MVMCoreUI/Containers/NavigationController.swift index 8e7279ce..0d4d0a56 100644 --- a/MVMCoreUI/Containers/NavigationController.swift +++ b/MVMCoreUI/Containers/NavigationController.swift @@ -93,10 +93,7 @@ import UIKit /// Convenience setter for legacy files public static func set(navigationController: UINavigationController, navigationJSON: [String: Any], viewController: UIViewController) throws { - guard let moleculeName = ModelRegistry.getType(for: navigationJSON.stringForkey(KeyMoleculeName), with: MoleculeModelProtocol.self) else { - throw ModelRegistry.Error.keyNotFound - } - guard let barModel = try moleculeName.decode(jsonDict: navigationJSON) as? (MoleculeModelProtocol & NavigationItemModelProtocol) else { + guard let barModel = try MoleculeObjectMapping.shared()?.getMoleculeModelForJSON(navigationJSON) as? (MoleculeModelProtocol & NavigationItemModelProtocol) else { throw ModelRegistry.Error.decoderOther(message: "Model not a bar model") } set(navigationController: navigationController, navigationItemModel: barModel, viewController: viewController) From 2ec4881be6df28e9db078483d4808820a3e0f50b Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Mon, 8 Jun 2020 10:01:17 +0530 Subject: [PATCH 35/44] layout file added --- MVMCoreUI.xcodeproj/project.pbxproj | 8 ++++---- .../UICollectionViewLeftAlignedLayout.swift | 0 2 files changed, 4 insertions(+), 4 deletions(-) rename MVMCoreUI/{Atomic/Atoms/Selectors => BaseClasses}/UICollectionViewLeftAlignedLayout.swift (100%) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 2521b6d2..4fbd6e9d 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -213,9 +213,9 @@ AAB9C10824346F4B00151545 /* RadioSwatches.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAB9C10724346F4B00151545 /* RadioSwatches.swift */; }; AAB9C10A243496DD00151545 /* RadioSwatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAB9C109243496DD00151545 /* RadioSwatch.swift */; }; AAC6F167243332E400F295C1 /* RadioSwatchesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAC6F166243332E400F295C1 /* RadioSwatchesModel.swift */; }; + BB105859248DEFF70069D008 /* UICollectionViewLeftAlignedLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB105858248DEFF60069D008 /* UICollectionViewLeftAlignedLayout.swift */; }; BB1D17E0244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */; }; BB1D17E2244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */; }; - BB258D37248A259000125E9D /* UICollectionViewLeftAlignedLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB258D36248A259000125E9D /* UICollectionViewLeftAlignedLayout.swift */; }; BB2BF0EA2452A9BB001D0FC2 /* ListDeviceComplexButtonSmall.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2BF0E92452A9BB001D0FC2 /* ListDeviceComplexButtonSmall.swift */; }; BB2BF0EC2452A9D5001D0FC2 /* ListDeviceComplexButtonSmallModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2BF0EB2452A9D5001D0FC2 /* ListDeviceComplexButtonSmallModel.swift */; }; BB2C968F24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */; }; @@ -656,9 +656,9 @@ AAB9C10724346F4B00151545 /* RadioSwatches.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatches.swift; sourceTree = ""; }; AAB9C109243496DD00151545 /* RadioSwatch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatch.swift; sourceTree = ""; }; AAC6F166243332E400F295C1 /* RadioSwatchesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatchesModel.swift; sourceTree = ""; }; + BB105858248DEFF60069D008 /* UICollectionViewLeftAlignedLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UICollectionViewLeftAlignedLayout.swift; sourceTree = ""; }; BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonMediumModel.swift; sourceTree = ""; }; BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonMedium.swift; sourceTree = ""; }; - BB258D36248A259000125E9D /* UICollectionViewLeftAlignedLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UICollectionViewLeftAlignedLayout.swift; sourceTree = ""; }; BB2BF0E92452A9BB001D0FC2 /* ListDeviceComplexButtonSmall.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonSmall.swift; sourceTree = ""; }; BB2BF0EB2452A9D5001D0FC2 /* ListDeviceComplexButtonSmallModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonSmallModel.swift; sourceTree = ""; }; BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableTextLinkAllTextAndLinksModel.swift; sourceTree = ""; }; @@ -1868,8 +1868,8 @@ 0AE14F63238315D2005417F8 /* TextField.swift */, D20923582450ECE00044AD09 /* TableView.swift */, D2755D7A23689C7500485468 /* TableViewCell.swift */, + BB105858248DEFF60069D008 /* UICollectionViewLeftAlignedLayout.swift */, D21B7F70243BAC1600051ABF /* CollectionViewCell.swift */, - BB258D36248A259000125E9D /* UICollectionViewLeftAlignedLayout.swift */, D264FAA92440F97600D98315 /* CollectionView.swift */, 0A5D59C323AD488600EFD9E9 /* Protocols */, 0A7918F423F5E7EA00772FF4 /* ImageView.swift */, @@ -2328,8 +2328,8 @@ 012A88DB238ED45900FE3DA1 /* CarouselModel.swift in Sources */, D2092355244FA0FD0044AD09 /* ThreeLayerTemplateModelProtocol.swift in Sources */, 0AE14F64238315D2005417F8 /* TextField.swift in Sources */, - BB258D37248A259000125E9D /* UICollectionViewLeftAlignedLayout.swift in Sources */, 0AB764D124460F6300E7FE72 /* UIDatePicker+Extension.swift in Sources */, + BB105859248DEFF70069D008 /* UICollectionViewLeftAlignedLayout.swift in Sources */, D253BB9C245874F8002DE544 /* BGImageMolecule.swift in Sources */, D2C78CD224228BBD00B69FDE /* ActionOpenPanelModel.swift in Sources */, AA617AB02453010A00910B8F /* ListDeviceComplexLinkSmall.swift in Sources */, diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/UICollectionViewLeftAlignedLayout.swift b/MVMCoreUI/BaseClasses/UICollectionViewLeftAlignedLayout.swift similarity index 100% rename from MVMCoreUI/Atomic/Atoms/Selectors/UICollectionViewLeftAlignedLayout.swift rename to MVMCoreUI/BaseClasses/UICollectionViewLeftAlignedLayout.swift From f4fa6d8291d7fc490e5d74723b69e461d7995dbb Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Mon, 8 Jun 2020 15:20:37 +0530 Subject: [PATCH 36/44] layout changes updated --- .../Atomic/Atoms/FormFields/Tags/Tags.swift | 1 + .../UICollectionViewLeftAlignedLayout.swift | 47 +++++++------------ 2 files changed, 17 insertions(+), 31 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/Tags/Tags.swift b/MVMCoreUI/Atomic/Atoms/FormFields/Tags/Tags.swift index bbb5502a..4b1fa4f9 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/Tags/Tags.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/Tags/Tags.swift @@ -61,6 +61,7 @@ open class Tags: View, MFButtonProtocol { let layout = UICollectionViewLeftAlignedLayout() layout.estimatedItemSize = CGSize(width: 140, height: 40) layout.minimumLineSpacing = 24.0 + layout.minimumInteritemSpacing = 12.0 return layout } diff --git a/MVMCoreUI/BaseClasses/UICollectionViewLeftAlignedLayout.swift b/MVMCoreUI/BaseClasses/UICollectionViewLeftAlignedLayout.swift index d5568b57..37be12bf 100644 --- a/MVMCoreUI/BaseClasses/UICollectionViewLeftAlignedLayout.swift +++ b/MVMCoreUI/BaseClasses/UICollectionViewLeftAlignedLayout.swift @@ -13,39 +13,24 @@ class UICollectionViewLeftAlignedLayout: UICollectionViewFlowLayout { guard let attributes = super.layoutAttributesForElements(in: rect) else { return nil } - var rows = [Row]() - var currentRowY: CGFloat = -1 + var newAttributesForElementsInRect = [UICollectionViewLayoutAttributes]() + var leftMargin: CGFloat = 0.0; + let leftPadding: CGFloat = 0 + let interItemSpacing = minimumInteritemSpacing + var maxY: CGFloat = -1.0 for attribute in attributes { - if currentRowY != attribute.frame.origin.y { - currentRowY = attribute.frame.origin.y - rows.append(Row(spacing: 10)) + if attribute.frame.origin.y >= maxY { + leftMargin = leftPadding + } else { + var newLeftAlignedFrame = attribute.frame + newLeftAlignedFrame.origin.x = leftMargin + attribute.frame = newLeftAlignedFrame } - rows.last?.add(attribute: attribute) - } - rows.forEach { $0.tagLayout(collectionViewWidth: collectionView?.frame.width ?? 0) } - return rows.flatMap { $0.attributes } - } -} - -class Row { - - var attributes = [UICollectionViewLayoutAttributes]() - var spacing: CGFloat = 0 - - init(spacing: CGFloat) { - self.spacing = spacing - } - - func add(attribute: UICollectionViewLayoutAttributes) { - attributes.append(attribute) - } - - func tagLayout(collectionViewWidth: CGFloat) { - let padding = 8 - var offset = padding - for attribute in attributes { - attribute.frame.origin.x = CGFloat(offset) - offset += Int(attribute.frame.width + spacing) + attribute.frame.origin.x = leftMargin + leftMargin += attribute.frame.width + interItemSpacing + maxY = max(attribute.frame.maxY, maxY) + newAttributesForElementsInRect.append(attribute) } + return newAttributesForElementsInRect } } From cd23384db34a384655f224274a18cd5a83f86a3b Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 8 Jun 2020 10:01:58 -0400 Subject: [PATCH 37/44] Made the code more concise --- .../UICollectionViewLeftAlignedLayout.swift | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/MVMCoreUI/BaseClasses/UICollectionViewLeftAlignedLayout.swift b/MVMCoreUI/BaseClasses/UICollectionViewLeftAlignedLayout.swift index 37be12bf..717bbc55 100644 --- a/MVMCoreUI/BaseClasses/UICollectionViewLeftAlignedLayout.swift +++ b/MVMCoreUI/BaseClasses/UICollectionViewLeftAlignedLayout.swift @@ -5,30 +5,21 @@ // Created by Dhamodaram Nandi on 05/06/20. // Copyright © 2020 Verizon Wireless. All rights reserved. // +// Left aligns items and makes the minimumInteritemSpacing absolute. import Foundation class UICollectionViewLeftAlignedLayout: UICollectionViewFlowLayout { override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { - guard let attributes = super.layoutAttributesForElements(in: rect) else { - return nil - } + guard let attributes = super.layoutAttributesForElements(in: rect) else { return nil } var newAttributesForElementsInRect = [UICollectionViewLayoutAttributes]() - var leftMargin: CGFloat = 0.0; - let leftPadding: CGFloat = 0 - let interItemSpacing = minimumInteritemSpacing - var maxY: CGFloat = -1.0 for attribute in attributes { - if attribute.frame.origin.y >= maxY { - leftMargin = leftPadding + if let previousFrame = newAttributesForElementsInRect.last, + MVMCoreGetterUtility.cgfequal(previousFrame.frame.minY, attribute.frame.minY) { + attribute.frame.origin.x = previousFrame.frame.maxX + minimumInteritemSpacing } else { - var newLeftAlignedFrame = attribute.frame - newLeftAlignedFrame.origin.x = leftMargin - attribute.frame = newLeftAlignedFrame + attribute.frame.origin.x = 0 } - attribute.frame.origin.x = leftMargin - leftMargin += attribute.frame.width + interItemSpacing - maxY = max(attribute.frame.maxY, maxY) newAttributesForElementsInRect.append(attribute) } return newAttributesForElementsInRect From f245d0c32170ae0b206e3ced848f95a19988c84a Mon Sep 17 00:00:00 2001 From: "Murugan, Vimal" Date: Mon, 8 Jun 2020 19:44:45 +0530 Subject: [PATCH 38/44] carousel itemILC added --- MVMCoreUI.xcodeproj/project.pbxproj | 8 +++ MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 + .../Molecules/Items/CarouselItemILC.swift | 71 +++++++++++++++++++ .../Items/CarouselItemILCModel.swift | 61 ++++++++++++++++ 4 files changed, 141 insertions(+) create mode 100644 MVMCoreUI/Atomic/Molecules/Items/CarouselItemILC.swift create mode 100644 MVMCoreUI/Atomic/Molecules/Items/CarouselItemILCModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 331da73c..b9dc159f 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -241,6 +241,8 @@ C695A69423C9909000BFB94E /* DoughnutChartModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A69323C9909000BFB94E /* DoughnutChartModel.swift */; }; C695A69623C990BC00BFB94E /* DoughnutChart.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A69523C990BC00BFB94E /* DoughnutChart.swift */; }; C695A69823C990C200BFB94E /* DoughnutChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A69723C990C200BFB94E /* DoughnutChartView.swift */; }; + C6A4920F248E17EB00643D3F /* CarouselItemILCModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A4920E248E17EB00643D3F /* CarouselItemILCModel.swift */; }; + C6A49211248E180600643D3F /* CarouselItemILC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A49210248E180600643D3F /* CarouselItemILC.swift */; }; C6FA7D5223C77A4A00A3614A /* UnOrderedList.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FA7D4F23C77A4700A3614A /* UnOrderedList.swift */; }; C6FA7D5323C77A4A00A3614A /* StringAndMoleculeStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FA7D5023C77A4800A3614A /* StringAndMoleculeStack.swift */; }; C6FA7D5423C77A4A00A3614A /* NumberedList.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FA7D5123C77A4900A3614A /* NumberedList.swift */; }; @@ -678,6 +680,8 @@ C695A69323C9909000BFB94E /* DoughnutChartModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DoughnutChartModel.swift; sourceTree = ""; }; C695A69523C990BC00BFB94E /* DoughnutChart.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DoughnutChart.swift; sourceTree = ""; }; C695A69723C990C200BFB94E /* DoughnutChartView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DoughnutChartView.swift; sourceTree = ""; }; + C6A4920E248E17EB00643D3F /* CarouselItemILCModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarouselItemILCModel.swift; sourceTree = ""; }; + C6A49210248E180600643D3F /* CarouselItemILC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarouselItemILC.swift; sourceTree = ""; }; C6FA7D4F23C77A4700A3614A /* UnOrderedList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnOrderedList.swift; sourceTree = ""; }; C6FA7D5023C77A4800A3614A /* StringAndMoleculeStack.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StringAndMoleculeStack.swift; sourceTree = ""; }; C6FA7D5123C77A4900A3614A /* NumberedList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NumberedList.swift; sourceTree = ""; }; @@ -1284,6 +1288,8 @@ D2A6390422CBCE160052ED1F /* MoleculeCollectionViewCell.swift */, 012A88C1238D7BCA00FE3DA1 /* CarouselItemModel.swift */, D21B7F74243BAC8900051ABF /* CarouselItem.swift */, + C6A4920E248E17EB00643D3F /* CarouselItemILCModel.swift */, + C6A49210248E180600643D3F /* CarouselItemILC.swift */, ); path = Items; sourceTree = ""; @@ -2096,6 +2102,7 @@ 01EB369423609801006832FA /* HeadlineBodyModel.swift in Sources */, D2A92884241ACB25004E01C6 /* ProgrammaticScrollViewController.swift in Sources */, 0A21DB7F235DECC500C160A2 /* EntryField.swift in Sources */, + C6A49211248E180600643D3F /* CarouselItemILC.swift in Sources */, D2E2A99F23E07F8A000B42E6 /* PillButton.swift in Sources */, D2C5001921F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m in Sources */, D29DF12E21E6851E003B2FB9 /* MVMCoreUITopAlertView.m in Sources */, @@ -2128,6 +2135,7 @@ 94C0150C2421564A005811A9 /* ActionCollapseNotificationModel.swift in Sources */, 014AA73123C5059B006F3E93 /* ListPageTemplateModel.swift in Sources */, D29DF2A221E7AF4E003B2FB9 /* MVMCoreUIUtility.m in Sources */, + C6A4920F248E17EB00643D3F /* CarouselItemILCModel.swift in Sources */, D29DF12B21E6851E003B2FB9 /* MVMCoreUITopAlertExpandableView.m in Sources */, 94C2D9A723872DA90006CF46 /* LabelAttributeColorModel.swift in Sources */, 943820842432382400B43AF3 /* WebView.swift in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index 4f151642..1602bd8d 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -134,6 +134,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: StackItem.self, viewModelClass: StackItemModel.self) MoleculeObjectMapping.shared()?.register(viewClass: MoleculeCollectionViewCell.self, viewModelClass: MoleculeCollectionItemModel.self) MoleculeObjectMapping.shared()?.register(viewClass: CarouselItem.self, viewModelClass: CarouselItemModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: CarouselItemILC.self, viewModelClass: CarouselItemILCModel.self) // Other Container Molecules diff --git a/MVMCoreUI/Atomic/Molecules/Items/CarouselItemILC.swift b/MVMCoreUI/Atomic/Molecules/Items/CarouselItemILC.swift new file mode 100644 index 00000000..548de74f --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/Items/CarouselItemILC.swift @@ -0,0 +1,71 @@ +// +// CarouselItemILC.swift +// MVMCoreUI +// +// Created by Murugan, Vimal on 08/06/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers open class CarouselItemILC: CollectionViewCell { + + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + + public let image = LoadImageView(frame: .zero) + public let label = Label(frame: .zero) + public let caretLink = CaretLink(frame: .zero) + public var stack: Stack + + public override init(frame: CGRect) { + stack = Stack.createStack(with: [ + (view: image, model: StackItemModel(horizontalAlignment: .fill)), + (view: label, model: StackItemModel(spacing: 6.0, horizontalAlignment: .fill)), + (view: caretLink, model: StackItemModel(spacing:52.0, horizontalAlignment: .leading, verticalAlignment: .trailing))], + axis: .vertical) + super.init(frame: frame) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + open override func setupView() { + super.setupView() + addMolecule(stack) + stack.restack() + // Make the whole cell focusable. + isAccessibilityElement = true + caretLink.isAccessibilityElement = false + accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint") + } + + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? CarouselItemILCModel else { return } + stack.updateContainedMolecules(with: [model.image, model.label, model.caretLink], + delegateObject, additionalData) + + updateAccessibilityLabel() + } + + public override func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) { + guard let action = (model as? CarouselItemILCModel)?.caretLink.action else { return } + Button.performButtonAction(with: action, button: self, delegateObject: delegateObject, additionalData: additionalData) + } + + func updateAccessibilityLabel() { + var message = "" + if let labelText = label.accessibilityLabel { + message += labelText + ", " + } + + if let caretLinkText = caretLink.titleLabel?.text { + message += caretLinkText + } + accessibilityLabel = message + } + +} diff --git a/MVMCoreUI/Atomic/Molecules/Items/CarouselItemILCModel.swift b/MVMCoreUI/Atomic/Molecules/Items/CarouselItemILCModel.swift new file mode 100644 index 00000000..dad7551c --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/Items/CarouselItemILCModel.swift @@ -0,0 +1,61 @@ +// +// CarouselItemILCModel.swift +// MVMCoreUI +// +// Created by Murugan, Vimal on 08/06/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers public class CarouselItemILCModel: ContainerModel, MoleculeModelProtocol, CarouselItemModelProtocol, CollectionItemModelProtocol { + + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + + public var backgroundColor: Color? + public var image: ImageViewModel + public var label: LabelModel + public var caretLink: CaretLinkModel + + public class var identifier: String { + return "carouselItemILC" + } + + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + + private enum CodingKeys: String, CodingKey { + case moleculeName + case backgroundColor + case label + case image + case caretLink + } + + //-------------------------------------------------- + // MARK: - Codec + //-------------------------------------------------- + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) + image = try typeContainer.decode(ImageViewModel.self, forKey: .image) + label = try typeContainer.decode(LabelModel.self, forKey: .label) + caretLink = try typeContainer.decode(CaretLinkModel.self, forKey: .caretLink) + try super.init(from: decoder) + } + + public override func encode(to encoder: Encoder) throws { + try super.encode(to: encoder) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) + try container.encode(image, forKey: .image) + try container.encode(label, forKey: .label) + try container.encode(caretLink, forKey: .caretLink) + try container.encode(moleculeName, forKey: .moleculeName) + } + +} From f730d58aa38a092abca0dbe12b8a1ac4870d9d6f Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 8 Jun 2020 10:45:52 -0400 Subject: [PATCH 39/44] error correction --- ...stRightVariablePriceChangeAllTextAndLinks.swift | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift index aef75633..72499f2e 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift @@ -8,14 +8,15 @@ import Foundation + @objcMembers open class ListRightVariablePriceChangeAllTextAndLinks: TableViewCell { - //----------------------------------------------------- // MARK: - Outlets //----------------------------------------------------- - public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero) - public let arrow = Arrow(frame: .zero) - public let rightLabel = Label(fontStyle: .Title2XLarge) + + public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink() + public let arrow = Arrow() + public let rightLabel = Label(fontStyle: .RegularBodySmall) private let stack: Stack private let arrowStackItem: StackItem private let rightLabelStackItem: StackItem @@ -67,9 +68,11 @@ import Foundation stack.restack() } - open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListRightVariablePriceChangeAllTextAndLinksModel else { return } + eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData) rightLabel.set(with: model.rightLabel, delegateObject, additionalData) arrow.set(with: model.arrow, delegateObject, additionalData) @@ -79,4 +82,3 @@ import Foundation return 121 } } - From 1a2266af10d1f5e19ccc9fdc15b9eb86ebadb474 Mon Sep 17 00:00:00 2001 From: "Murugan, Vimal" Date: Mon, 8 Jun 2020 21:10:45 +0530 Subject: [PATCH 40/44] mark didselectcell as open --- MVMCoreUI.xcodeproj/project.pbxproj | 8 --- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 - .../Molecules/Items/CarouselItemILC.swift | 71 ------------------- .../Items/CarouselItemILCModel.swift | 61 ---------------- .../BaseClasses/CollectionViewCell.swift | 2 +- 5 files changed, 1 insertion(+), 142 deletions(-) delete mode 100644 MVMCoreUI/Atomic/Molecules/Items/CarouselItemILC.swift delete mode 100644 MVMCoreUI/Atomic/Molecules/Items/CarouselItemILCModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index b9dc159f..331da73c 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -241,8 +241,6 @@ C695A69423C9909000BFB94E /* DoughnutChartModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A69323C9909000BFB94E /* DoughnutChartModel.swift */; }; C695A69623C990BC00BFB94E /* DoughnutChart.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A69523C990BC00BFB94E /* DoughnutChart.swift */; }; C695A69823C990C200BFB94E /* DoughnutChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A69723C990C200BFB94E /* DoughnutChartView.swift */; }; - C6A4920F248E17EB00643D3F /* CarouselItemILCModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A4920E248E17EB00643D3F /* CarouselItemILCModel.swift */; }; - C6A49211248E180600643D3F /* CarouselItemILC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A49210248E180600643D3F /* CarouselItemILC.swift */; }; C6FA7D5223C77A4A00A3614A /* UnOrderedList.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FA7D4F23C77A4700A3614A /* UnOrderedList.swift */; }; C6FA7D5323C77A4A00A3614A /* StringAndMoleculeStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FA7D5023C77A4800A3614A /* StringAndMoleculeStack.swift */; }; C6FA7D5423C77A4A00A3614A /* NumberedList.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FA7D5123C77A4900A3614A /* NumberedList.swift */; }; @@ -680,8 +678,6 @@ C695A69323C9909000BFB94E /* DoughnutChartModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DoughnutChartModel.swift; sourceTree = ""; }; C695A69523C990BC00BFB94E /* DoughnutChart.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DoughnutChart.swift; sourceTree = ""; }; C695A69723C990C200BFB94E /* DoughnutChartView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DoughnutChartView.swift; sourceTree = ""; }; - C6A4920E248E17EB00643D3F /* CarouselItemILCModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarouselItemILCModel.swift; sourceTree = ""; }; - C6A49210248E180600643D3F /* CarouselItemILC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarouselItemILC.swift; sourceTree = ""; }; C6FA7D4F23C77A4700A3614A /* UnOrderedList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnOrderedList.swift; sourceTree = ""; }; C6FA7D5023C77A4800A3614A /* StringAndMoleculeStack.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StringAndMoleculeStack.swift; sourceTree = ""; }; C6FA7D5123C77A4900A3614A /* NumberedList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NumberedList.swift; sourceTree = ""; }; @@ -1288,8 +1284,6 @@ D2A6390422CBCE160052ED1F /* MoleculeCollectionViewCell.swift */, 012A88C1238D7BCA00FE3DA1 /* CarouselItemModel.swift */, D21B7F74243BAC8900051ABF /* CarouselItem.swift */, - C6A4920E248E17EB00643D3F /* CarouselItemILCModel.swift */, - C6A49210248E180600643D3F /* CarouselItemILC.swift */, ); path = Items; sourceTree = ""; @@ -2102,7 +2096,6 @@ 01EB369423609801006832FA /* HeadlineBodyModel.swift in Sources */, D2A92884241ACB25004E01C6 /* ProgrammaticScrollViewController.swift in Sources */, 0A21DB7F235DECC500C160A2 /* EntryField.swift in Sources */, - C6A49211248E180600643D3F /* CarouselItemILC.swift in Sources */, D2E2A99F23E07F8A000B42E6 /* PillButton.swift in Sources */, D2C5001921F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m in Sources */, D29DF12E21E6851E003B2FB9 /* MVMCoreUITopAlertView.m in Sources */, @@ -2135,7 +2128,6 @@ 94C0150C2421564A005811A9 /* ActionCollapseNotificationModel.swift in Sources */, 014AA73123C5059B006F3E93 /* ListPageTemplateModel.swift in Sources */, D29DF2A221E7AF4E003B2FB9 /* MVMCoreUIUtility.m in Sources */, - C6A4920F248E17EB00643D3F /* CarouselItemILCModel.swift in Sources */, D29DF12B21E6851E003B2FB9 /* MVMCoreUITopAlertExpandableView.m in Sources */, 94C2D9A723872DA90006CF46 /* LabelAttributeColorModel.swift in Sources */, 943820842432382400B43AF3 /* WebView.swift in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index 1602bd8d..4f151642 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -134,7 +134,6 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: StackItem.self, viewModelClass: StackItemModel.self) MoleculeObjectMapping.shared()?.register(viewClass: MoleculeCollectionViewCell.self, viewModelClass: MoleculeCollectionItemModel.self) MoleculeObjectMapping.shared()?.register(viewClass: CarouselItem.self, viewModelClass: CarouselItemModel.self) - MoleculeObjectMapping.shared()?.register(viewClass: CarouselItemILC.self, viewModelClass: CarouselItemILCModel.self) // Other Container Molecules diff --git a/MVMCoreUI/Atomic/Molecules/Items/CarouselItemILC.swift b/MVMCoreUI/Atomic/Molecules/Items/CarouselItemILC.swift deleted file mode 100644 index 548de74f..00000000 --- a/MVMCoreUI/Atomic/Molecules/Items/CarouselItemILC.swift +++ /dev/null @@ -1,71 +0,0 @@ -// -// CarouselItemILC.swift -// MVMCoreUI -// -// Created by Murugan, Vimal on 08/06/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation - -@objcMembers open class CarouselItemILC: CollectionViewCell { - - //-------------------------------------------------- - // MARK: - Properties - //-------------------------------------------------- - - public let image = LoadImageView(frame: .zero) - public let label = Label(frame: .zero) - public let caretLink = CaretLink(frame: .zero) - public var stack: Stack - - public override init(frame: CGRect) { - stack = Stack.createStack(with: [ - (view: image, model: StackItemModel(horizontalAlignment: .fill)), - (view: label, model: StackItemModel(spacing: 6.0, horizontalAlignment: .fill)), - (view: caretLink, model: StackItemModel(spacing:52.0, horizontalAlignment: .leading, verticalAlignment: .trailing))], - axis: .vertical) - super.init(frame: frame) - } - - public required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - open override func setupView() { - super.setupView() - addMolecule(stack) - stack.restack() - // Make the whole cell focusable. - isAccessibilityElement = true - caretLink.isAccessibilityElement = false - accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint") - } - - open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { - super.set(with: model, delegateObject, additionalData) - guard let model = model as? CarouselItemILCModel else { return } - stack.updateContainedMolecules(with: [model.image, model.label, model.caretLink], - delegateObject, additionalData) - - updateAccessibilityLabel() - } - - public override func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) { - guard let action = (model as? CarouselItemILCModel)?.caretLink.action else { return } - Button.performButtonAction(with: action, button: self, delegateObject: delegateObject, additionalData: additionalData) - } - - func updateAccessibilityLabel() { - var message = "" - if let labelText = label.accessibilityLabel { - message += labelText + ", " - } - - if let caretLinkText = caretLink.titleLabel?.text { - message += caretLinkText - } - accessibilityLabel = message - } - -} diff --git a/MVMCoreUI/Atomic/Molecules/Items/CarouselItemILCModel.swift b/MVMCoreUI/Atomic/Molecules/Items/CarouselItemILCModel.swift deleted file mode 100644 index dad7551c..00000000 --- a/MVMCoreUI/Atomic/Molecules/Items/CarouselItemILCModel.swift +++ /dev/null @@ -1,61 +0,0 @@ -// -// CarouselItemILCModel.swift -// MVMCoreUI -// -// Created by Murugan, Vimal on 08/06/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation - -@objcMembers public class CarouselItemILCModel: ContainerModel, MoleculeModelProtocol, CarouselItemModelProtocol, CollectionItemModelProtocol { - - //-------------------------------------------------- - // MARK: - Properties - //-------------------------------------------------- - - public var backgroundColor: Color? - public var image: ImageViewModel - public var label: LabelModel - public var caretLink: CaretLinkModel - - public class var identifier: String { - return "carouselItemILC" - } - - //-------------------------------------------------- - // MARK: - Keys - //-------------------------------------------------- - - private enum CodingKeys: String, CodingKey { - case moleculeName - case backgroundColor - case label - case image - case caretLink - } - - //-------------------------------------------------- - // MARK: - Codec - //-------------------------------------------------- - - required public init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) - image = try typeContainer.decode(ImageViewModel.self, forKey: .image) - label = try typeContainer.decode(LabelModel.self, forKey: .label) - caretLink = try typeContainer.decode(CaretLinkModel.self, forKey: .caretLink) - try super.init(from: decoder) - } - - public override func encode(to encoder: Encoder) throws { - try super.encode(to: encoder) - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) - try container.encode(image, forKey: .image) - try container.encode(label, forKey: .label) - try container.encode(caretLink, forKey: .caretLink) - try container.encode(moleculeName, forKey: .moleculeName) - } - -} diff --git a/MVMCoreUI/BaseClasses/CollectionViewCell.swift b/MVMCoreUI/BaseClasses/CollectionViewCell.swift index 848509c9..5f464f2d 100644 --- a/MVMCoreUI/BaseClasses/CollectionViewCell.swift +++ b/MVMCoreUI/BaseClasses/CollectionViewCell.swift @@ -98,7 +98,7 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo } // MARK: - Override - public func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) { + open func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) { guard let action = model?.action else { return } Button.performButtonAction(with: action, button: self, delegateObject: delegateObject, additionalData: additionalData) } From 24fc03406ade305f128ee33099b4cb8e890bd6a8 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 8 Jun 2020 13:14:11 -0400 Subject: [PATCH 41/44] correction --- .../ListOneColumnFullWidthTextDividerSubsection.swift | 2 +- MVMCoreUI/Atomic/Molecules/Doughnut/DoughnutChart.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsection.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsection.swift index f0f91828..8261a28a 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsection.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsection.swift @@ -14,7 +14,7 @@ import Foundation //----------------------------------------------------- public var stack: Stack public let headline = Label(fontStyle: .BoldBodySmall) - public let body = Label(fontStyle: .BoldBodySmall) + public let body = Label(fontStyle: .RegularBodySmall) // MARK: - Initializers public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { diff --git a/MVMCoreUI/Atomic/Molecules/Doughnut/DoughnutChart.swift b/MVMCoreUI/Atomic/Molecules/Doughnut/DoughnutChart.swift index 649c9c5e..3b59ded3 100644 --- a/MVMCoreUI/Atomic/Molecules/Doughnut/DoughnutChart.swift +++ b/MVMCoreUI/Atomic/Molecules/Doughnut/DoughnutChart.swift @@ -15,8 +15,8 @@ open class DoughnutChart: View { //-------------------------------------------------- public var doughnutLayer = CALayer() - public var titleLabel = Label(fontStyle: .BoldTitleLarge, true) - public var subTitleLabel = Label(fontStyle: .RegularMicro, true) + public var titleLabel = Label(fontStyle: .BoldTitleLarge) + public var subTitleLabel = Label(fontStyle: .RegularMicro) public var labelContainer = MVMCoreUICommonViewsUtility.commonView() public static let heightConstant: CGFloat = 136 private var sizeObject = MFStyler.sizeObjectGeneric(forCurrentDevice: heightConstant)! From 81d3b818e3ea8bbe31dbeef2b3522fe98c701877 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 8 Jun 2020 13:32:31 -0400 Subject: [PATCH 42/44] making use of Styler --- MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift index abc37c43..73de7760 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift @@ -121,7 +121,7 @@ public typealias ActionBlock = () -> () setupView() font = fontStyle.getFont(false) - textColor = .mvmBlack + textColor = fontStyle.color() setScale(scale) } From 9f547669f6b7a9f8aa4f76bfdb597e01210c585f Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 8 Jun 2020 14:43:38 -0400 Subject: [PATCH 43/44] Minor cleaning --- MVMCoreUI/Atomic/Atoms/Views/ImageViewModel.swift | 5 ++++- MVMCoreUI/Atomic/Atoms/Views/LineModel.swift | 6 ++++++ MVMCoreUI/BaseControllers/ViewController.swift | 2 +- MVMCoreUI/FormUIHelpers/FormValidator.swift | 12 ++++++------ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/ImageViewModel.swift b/MVMCoreUI/Atomic/Atoms/Views/ImageViewModel.swift index d5ba0a14..637b074d 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/ImageViewModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/ImageViewModel.swift @@ -21,8 +21,11 @@ import Foundation public var contentMode: UIView.ContentMode? public var localBundle: Bundle? - public init(image: String) { + public init(image: String, imageFormat: String? = nil, width: CGFloat? = nil, height: CGFloat? = nil) { self.image = image + self.imageFormat = imageFormat + self.width = width + self.height = height } private enum CodingKeys: String, CodingKey { diff --git a/MVMCoreUI/Atomic/Atoms/Views/LineModel.swift b/MVMCoreUI/Atomic/Atoms/Views/LineModel.swift index 3189deab..0f67b3f0 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LineModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LineModel.swift @@ -71,6 +71,12 @@ import UIKit self.useVerticalLine = false } + public init(verticalLineOf type: Style, backgroundColor: Color? = nil) { + self.type = type + self.backgroundColor = backgroundColor + self.useVerticalLine = true + } + //-------------------------------------------------- // MARK: - Keys //-------------------------------------------------- diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index 717a5761..395587ec 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -263,7 +263,7 @@ import UIKit // MARK: - TabBar open func updateTabBar() { guard MVMCoreUISplitViewController.main()?.getCurrentDetailViewController() == self, - var tabModel = pageModel as? TabPageModelProtocol else { return } + let tabModel = pageModel as? TabPageModelProtocol else { return } if let index = tabModel.tabBarIndex { MVMCoreUISplitViewController.main()?.tabBar?.highlightTab(at: index) } diff --git a/MVMCoreUI/FormUIHelpers/FormValidator.swift b/MVMCoreUI/FormUIHelpers/FormValidator.swift index 744304ba..0ece4b4b 100644 --- a/MVMCoreUI/FormUIHelpers/FormValidator.swift +++ b/MVMCoreUI/FormUIHelpers/FormValidator.swift @@ -15,12 +15,12 @@ import MVMCore // MARK: - Properties //-------------------------------------------------- - static var defaultGroupName: String = "default" - var formRules: [FormGroupRule]? - weak var delegate: FormHolderProtocol? - var fields: [String: FormFieldProtocol] = [:] - var groupWatchers: [FormGroupWatcherFieldProtocol] = [] - var radioButtonsModelByGroup: [String: RadioButtonSelectionHelper] = [:] + public static var defaultGroupName: String = "default" + public var formRules: [FormGroupRule]? + public weak var delegate: FormHolderProtocol? + public var fields: [String: FormFieldProtocol] = [:] + public var groupWatchers: [FormGroupWatcherFieldProtocol] = [] + public var radioButtonsModelByGroup: [String: RadioButtonSelectionHelper] = [:] //-------------------------------------------------- // MARK: - Initializer From ee029aa103902af3d0626427f0d95fe0d99839b4 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 8 Jun 2020 17:10:54 -0400 Subject: [PATCH 44/44] matching change in label --- MVMCoreUI/Atomic/Atoms/FormFields/Tags/Tag.swift | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/Tags/Tag.swift b/MVMCoreUI/Atomic/Atoms/FormFields/Tags/Tag.swift index c962f8c9..bc905a79 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/Tags/Tag.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/Tags/Tag.swift @@ -8,11 +8,18 @@ import Foundation + @objcMembers open class Tag: View { + //-------------------------------------------------- + // MARK: - Outlets + //-------------------------------------------------- - public let label = Label.createLabelRegularBodySmall(true) + public let label = Label(fontStyle: .RegularBodySmall) + //-------------------------------------------------- // MARK: - MVMCoreViewProtocol + //-------------------------------------------------- + open override func setupView() { super.setupView() layer.borderColor = UIColor.mvmCoolGray6.cgColor @@ -22,9 +29,10 @@ import Foundation NSLayoutConstraint.constraintPinSubview(label, pinTop: true, topConstant: 13, pinBottom: true, bottomConstant: 13, pinLeft: true, leftConstant: 15, pinRight: true, rightConstant: 15) } - // MARK: - MoleculeViewProtocol open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + guard let model = model as? TagModel else { return } + label.set(with: model.label, delegateObject, additionalData) } @@ -36,6 +44,6 @@ import Foundation open override func reset() { super.reset() label.reset() - label.styleRegularBodySmall(true) + label.setFontStyle(.RegularBodySmall) } }