Tipster and MVC
Over the weekend I finished tipster, an assignment where we make use of a slider UI slider to determine tip % where when you enter a value, the tip amount will change automatically when sliding the slider. A big annoyance that I dealt with was how the labels in the storyboard is laid out so that it will always do a ".." if the number is too big for the label dimension and how hard it was to change it. When it's all said and done, my code was pretty long so there is a lot of refactoring to be done. And as if the help me with this, today I learned about iOS MVC. I haven't talked about MVC's in a while, with my last post about it being all the way back in the MEAN stack but iOS apparently also has an MVC structure.
With Tipster and Tic Tac Toe, I put a lot of my logic in the models file since the view controller should be only be receiving and sending information to and from the view. iOS development is a lot more free-form with MVC, since you don't necessarily have to have a models file. This helps with the structure but one thing I realized when I tried implementing the style is passing data to and from the view controller and the data file. This can be fixed with writing functions in the model that takes in parameters and having the controllers call that function and pass in whatever values. Anyways, gonna be working on data persistence next!
No comments:
Post a Comment