(A Swift equivalent of ColourLove)
This project only purpose is to provide brief, clean and readable code in a dummy application. It is heavily library based and MVC oriented and shows mecanisms like downloading, storing and displaying data from a webservice. Local data is handled with the Realm library.
You are of course invited to use, fork and improve this project using your own knowledge. I'll try to update the code with up to date libraries and conventions.
KISS : Kepp It Simple Stupid
- ViewControllers are suffixed by 'VC'
- Models should be self-explanatory and match the server model (if possible)
- Custom views should indicate the superclass type (like
ColorCell
which extendsUITableViewCell
)
Dependencies are managed via CocoaPods
git clone [email protected]:kirualex/ColourLoveSwift.git
cd ColourLoveSwift
gem install cocoapods
pod setup
pod install
open ColourLoveSwift.xcworkspace
Using Swiftgen, we automatically generate safe code for storyboards, images, localizable and colors. Here is the script used just before the "Compile Sources" phase to achieve this.
if hash swiftgen 2>/dev/null; then
swiftgen strings --output "${SRCROOT}/ColourLoveSwift/Swiftgen/L10n.swift" "${SRCROOT}/ColourLoveSwift/Resources/Strings/Base.lproj/Localizable.strings"
swiftgen images --output "${SRCROOT}/ColourLoveSwift/Swiftgen/UIImage+Assets.swift" "${SRCROOT}/ColourLoveSwift/Resources/"
swiftgen storyboards --output "${SRCROOT}/ColourLoveSwift/Swiftgen/UIStoryboard+Gen.swift" "${SRCROOT}/ColourLoveSwift/Resources/Storyboards/"
swiftgen colors --output "${SRCROOT}/ColourLoveSwift/Swiftgen/UIColor+Gen.swift" "${SRCROOT}/ColourLoveSwift/Resources/colors.txt"
else
echo "Swiftgen does not exist, download from https://github.com/AliSoftware/SwiftGen"
fi
Swiftlint is a great way to ensure the codebase stay clean and hopefully readable. You can tweak the rules in the .swiftlint.yml
file