Practice writing and refactoring clean code with good style
-
Clone this repository to create a local copy on your computer
git clone https://github.com/IntrepidPursuits/code-style-exercise-ios.git
-
Create a branch called
<your-name>/clean-code
git checkout -b <your-name>/clean-code
The app uses a UICollectionView
to display a randomized color palette. When a colored square is tapped, its hex value appears in either black or white depending on the lightness or darkness of the color. When the "Generate New Colors" button is tapped, the palette refreshes and displays the user-defined number of colored squares. If no value is specified, it defaults to 12 squares.
Go through the code provided and fix any style issues you find. The fixes for the problems can range from small (e.g. spacing) to large (e.g. completely refactor the logic flow). Remember that we're aiming for clarity over brevity. If you need help, refer to the Intrepid Swift Style Guide.
-
Push your branch up to Github
git push origin <your-name>/clean-code
-
Create a pull request on Github and fix any issues found in code review