Giter VIP home page Giter VIP logo

swift-project-template's Introduction

swift-project-template

Build Status

🍪 Cookiecutter template for Swift iOS projects.

swift-project-template

Features:

  • Xcode 11 and Swift 5.0 support
  • AppCode support
  • Custom project structure (the same in the project and on the disk)
  • Configurations and schemes:

swift-project-template

  • Custom scripts for Carthage and SwiftLint
  • iOS Deployment Target - 12.0
  • Optional integrations:
  • Template for Github pull requests
  • Settings.bundle with app version
  • Disabled automatic code signing (sorry, Apple 🤷‍♂️)
  • -Xfrontend -debug-time-function-bodies flags for profiling compilation times
  • .gitattributes for correct repo language detection via linguist

Usage

  1. Install Cookiecutter:

    brew install cookiecutter

  2. Run cookiecutter gh:artemnovichkov/swift-project-template. No need to create project folder manually, cookiecutter does it for you.

For future runs you can shorten the command to cookiecutter swift-project-template. However, if you want to use the most recent template you should still run the full command above. Or just create an alias:

alias template="cookiecutter gh:artemnovichkov/swift-project-template"

Author

Artem Novichkov, [email protected]

License

swift-project-template is available under the MIT license. See the LICENSE file for more info.

swift-project-template's People

Contributors

aldocano avatar antowkos avatar artemnovichkov avatar caipre avatar otbivnoe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

swift-project-template's Issues

Remove settings.yml

Delete settings.yml configuration, because bots don't work with private repos.

CI for build check

Add CI (Circle CI for example) and check that changes will not break a project build.

Add new configurations and related schemes

List of configurations:

  • Analyze
  • Debug Development
  • Debug Staging
  • Debug Production
  • AdHoc Development
  • AdHoc Staging
  • AdHoc Production
  • AppStore

List of schemes:

  • Debug Development
  • Debug Staging
  • Debug Production
  • AdHoc Development
  • AdHoc Staging
  • AdHoc Production
  • AppStore

Add Build Phase script for SwiftGen

Something like that:

if [ -f "$SRCROOT"/Resources/Assets.swift ]; then
    chmod +w "$SRCROOT"/Resources/Assets.swift
fi
if [ -f "$SRCROOT"/Resources/Strings.swift ]; then
    chmod +w "$SRCROOT"/Resources/Strings.swiftt
fi
swiftgen
chmod -w "$SRCROOT"/Resources/Assets.swift
chmod -w "$SRCROOT"/Resources/Strings.swift

Add it before Compile Sources phase to check errors during builds. Don;t forget to check use_swiftgen flag.

Carthage is an undocumented dependency

Running cookiecutter failed for me:

Initialized empty Git repository in ...
/var/folders/yd/38lbvn4x4d52x1jxtk2q5lf40000gn/T/tmpHfaQHP.sh: line 6: carthage: command not found
ERROR: Stopping generation because post_gen_project hook script didn't exit successfully
Hook script failed (exit status: 127)

Resolved by running brew install carthage.

Add support of Xcode 9.x

Xcode 9.3 breaks Codable inits. I have an idea of supporting multiple versions of Xcode. My suggestion is to support all minor versions of current and previous major versions, for instance, 8.x-9.x. It's available via --checkout flag with name of branch:

cookiecutter gh:artemnovichkov/swift-project-template --checkout xcode-9.3

Add script for Swiftgen

I want to add a script fro Swiftgen in Analyze scheme before build to sync localizations.

Add DEBUG and ADHOC flags

Sometimes it's needed to add logic for all debug schemes, for instance:

#if DEBUG || ADHOC

        let fingerTipWindow = MBFingerTipWindow(frame: UIScreen.main.bounds)
        fingerTipWindow.alwaysShowTouches = UserDefaults.standard.isFingertipsEnabled
        window = fingerTipWindow
        Deboogger.configure(with: MeasurementPlugin(), HeightPlugin(), WeightPlugin(), FingertipsPlugin())

        #else

        window = UIWindow(frame: UIScreen.main.bounds)

        #endif

I would like to add common flags for those scheme types.

Add CODEOWNERS

Add CODEOWNERS like:

# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.

# These owners will be the default owners for everything in the repo.
*       @artemnovichkov

# Order is important. The last matching pattern has the most precedence.
# So if a pull request only touches Swift files, only these owners
# will be requested to review.
*.swift    @artemnovichkov @otbivnoe

# You can also use email addresses if you prefer.
docs/*  [email protected]

Read more here.

Add project name to scheme names

There are some schemes with names like "Adhoc Debug" or "AppStore". The names are used for archive names. Please append a project name, for example, "MyProject AppStore".

Add Settings bot configuration

There are a lot of settings on Github. But I don't want to configure new repos manually. With Settings bot you can share configuration between repos. Think about it and add right configuration for private project repos.

Update Swiftlint

Add Swiftlint rules:

type_contents_order:
  order:
    - case
    - associated_type
    - type_alias
    - subtype
    - [type_property, instance_property]
    - [initializer, type_method, view_life_cycle_method, subscript, other_method, ib_action]

file_header:
  required_pattern: |
                    \/\/
                    \/\/  Copyright © \d{4}\ .*?. All rights reserved.
                    \/\/

Created project doesn't build in AppCode

Just create project via this template and try to build it on simulator in AppCode. Build will be failed. After small investigations I found out that fail happens because of

The following build commands failed:
	Check dependencies

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.