Skip to content

Architecture Discussions

giovanni-gardusi edited this page Jan 9, 2019 · 1 revision

iOS Architecture Discussions

Xibs and Views

  • Never use programatic views, use xib
  • Do not use storyboard, since it becomes too difficult to guide youserlf in the project and too many xml conflicts occur
  • Use solely Autolayout
  • UIButton vs UITapGesture: Use UIButton, due to its click response and xib visibility
    • Evade using both UIButton and UITapGesture in the same app
    • Exceptions: buttons overlay and double touch (number of taps)
  • UIImageView with UILabel
    • Solutions: hide label view, or decrease the number of views added to image label, when feasible
  • Lone Cell should not be made as UITableViewCell
    • Use UIView, fromNib and addSubview
  • Logically divide xibs in views
    • Subdivide xib in new xibs if the component is reusable or there is view shifting, and use the same file when it is not reusable

Lists

  • Stop using UITableView in every case:
    • Don'ts: static screens (ex: forms, menus); use UIStackView in these cases
    • Dos: screens where data are dynamically loading (ex: feeds)
  • RX driven validation? At first, don't use it. We will develop a component and test it.
  • Create Single Tap component for button (block double actions by button double clicking, useful at upload screens and follow cells)
  • Modularized Coordinator vs unique: use modularization because and unique Coordinator:
    • Is too big and group too many screen opening methods
    • Keep UINavigationController as a unique singleton
  • Modularize UIViewControllers por caso de uso
  • Modularize cells and views by type (header, feed, card, footer, banner, etc)
  • Annotate at Zeplin which cells are similar

View Models

  • Delegate, Data Source, Feedback: keep and use these protocols
    • Get Methods should not return models, but info that will be used in the visual schema
    • Callback usage:
      • Don not use it in ViewController communication with ViewModel, since binding is made by delegate protocols.
      • Use in decision Dialogs and visual interactions (follow button)
  • ObserveRealm usage:
    • Wrap it, allowing seamless communication between ViewModel and Service using feedback
      • This allow us to decouple Observable and ViewModel, improving code debug
  • Realm vs Core Data:
    • Keep Realm, but make Core Data PoC

Services and ServiceModels

  • Request Models, Response, Realm:
    • Eliminate RequestModel, implement toRequest() methods in Model
    • Group RealmModel and RequestModel in ServiceModel, implementing Mappable and RealmObject
  • Implement Repository classes, responsible for info receiving from backend and do conversion and sending to Realm

Clone this wiki locally