Skip to content

Linter, code formatter pre-setup swift template with MVC pattern

License

Notifications You must be signed in to change notification settings

wataru-maeda/swift-boilerplate

Repository files navigation

Swift Boilerplate

Motivation

Setup base project for ios(swift) development by following best practices. Aim to reuse in various projects. The purpose of using the boilerplate is to avoid redundant effort setup projects from scratch.

What's included

  • Autocorrect/format code when build using SwiftFormat
  • Lint test on build/Pull Request using SwiftLint
  • Resource management using R.swift
  • Dev/Staging/Production configurations
  • File structure with MVC pattern
  • Configure FontAwesome
  • Unit/UI tests automation
  • Distribute app by Fastlane

How to use

  1. Click Use this template or download the repo
  2. Open the project with an editor like VSCode or Sublime text. Replace keyword SwiftBoilterplate with your project name
  3. Rename folder/file name (*1)
  4. Go to the root directory. Install packages by the command pod install
  5. Open {YOUR-PROJECT-NAME}.xcworkspace. Then build the project (command + b). It will generate R.swift resource file.
  6. Run the project (command + r)

(*1)

/SwiftBoilterplate -> /{YOUR-PROJECT-NAME}
/SwiftBoilterplateTests/SwiftBoilterplateTests.swift -> /{YOUR-PROJECT-NAME}Tests/{YOUR-PROJECT-NAME}Tests.swift
/SwiftBoilterplateUITests/SwiftBoilterplateUITests.swift -> /{YOUR-PROJECT-NAME}UITests/{YOUR-PROJECT-NAME}UITests.swift

File structure

.
├── Resources              # images, fonts and colors
├── Classes
│   ├── routes             # navigation, tabbar, sidemenu
│   ├── factories          # reusable UI component factories 
│   ├── services           # networking, api communication
│   ├── models
│   ├── views              # screens, view modules
│   ├── helpers
│   |   ├── libs           # libraries
│   |   ├── utils          # utilities
│   |   └── exts           # extensions
│   └── configs            # configurations
└── Supporting Files       # plist, formatter, lint config files

Setup dev/staging/production scheme

The default scheme is release. Please create dev, staging scheme if you need

  1. Click Edit Scheme -> Duplicate Scheme
  2. Update Build Configuration to Develop, Staging in Run, Test and others
  3. After the scheme update, you will able to switch configuration. Variables can be set in AppEnv.swift

Libraries

DevOps

Licence

This project is available under the MIT license. See the LICENSE file for more info.

About

Linter, code formatter pre-setup swift template with MVC pattern

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published