Skip to content

A modified template for the Clean Swift architecture.

License

Notifications You must be signed in to change notification settings

pakej/clean-swift-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CleanSwift Template

This is a CleanSwift template modified from the original, to accomodate common project usage.

Modifications

  1. All Files

    • All file templates are updated so that upon scene generation, the app still works without throwing errors.
    • Pre-built with 4 common use cases:
      1. Upon entering a screen - fetchFromLocalDataStore(with:)
        • There's almost always local data to be displayed on the screen.
      2. Upon entering a screen - fetchFromRemoteDataStore(with:)
        • Sometimes a data need to be fetched from an external source.
        • This use case decouples from local data fetching use case and allows it to be reused if needed (ie. Pull-To-Refresh).
      3. Tracking analytics - trackAnalytics(with:)
        • Sometimes a triggered UI element needs to be tracked for app improvements.
        • This use case made it easier.
      4. Upon leaving a screen - perform<SCENE_NAME>(with:)
        • In order to leave a screen, a use case is almost always needed.
  2. Models

    • The template generates a file appended with the word models to make it more obvious.
  3. Interactor, Presenter & ViewController

    • Each Use Case logic would have the comment header // MARK: - Use Case - for better readability between the Use Case & other functions.
  4. Unit Test

    • The templates are also updated to test the pre-built use cases.
    • A template that is written using the Quick and Nimble libraries are also added if it's preferred over XCTest.
  5. Removed

    • UICollectionViewController and UITableViewController templates are removed since the templates use the UIViewController templates anyway.

Installation

  1. Clone this repository

  2. From this repository:

    To install the Clean Swift Xcode templates,run:

    $ make install_templates

    To uninstall the Clean Swift Xcode templates, run:

    $ make uninstall_templates

References

To learn more about Clean Swift and the VIP cycle, read:

There is a sample app available at:

About

A modified template for the Clean Swift architecture.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published