Flare Refactoring
-
Method length. Like in Ruby, you want to try and keep to the Single Responsibility Principle, and make sure each method + class does one thing only. Example here: https://gist.github.com/yvettecook/507e40561ef77a6102ac83ea46f5a972 taken from FlareDetailViewController. But as a very very very rough guide, I'd aim for <5 lines per method. Less is awesome.
-
Isolate your dependencies. At the moment, Firebase is everywhere in your app. But, what if Google stop supporting it? It's good practice in general (not just on mobile) to try and isolate your external dependencies, so you're not completely screwed if you need to replace one solution with another. This is maybe more advanced refactoring, but if you can hide Firebase behind a more generic model (like
Database.swift
) which is a singleton (see this article http://krakendev.io/blog/the-right-way-to-write-a-singleton), you can replace this (from LoginVC):if let user = FIRAuth.auth()?.currentUser
{ ... } to `if let database.current