Swiftpack.co - Package - SvenTiigi/SwiftKit

Features

  • ☑ Generated Kit supports iOS, tvOS, watchOS and macOS
  • CocoaPods, Carthage and Swift Package Manager compatibility
  • README.md template
  • ☑ Fastlane already integrated for tests and release
  • Jazzy to generate documentation
  • SwiftLint Build-Phase integrated
  • CI-Service configuration templates included (GitHub, Travis, GitLab, Azure Pipelines)
  • ☑ Automatically checks if the Kit name is already taken on CocoaPods
  • ☑ GitHub issue templates for Bug reports and Feature requests

Installation

Mint 🌱

Mint is a package manager that installs and runs Swift command line tool packages.

$ mint install SvenTiigi/SwiftKit

Homebrew 🍺

Homebrew is a free and open-source software package management system that simplifies the installation of software on Apple's macOS operating system.

$ brew tap SvenTiigi/SwiftKit
$ brew install swiftkit

Update

To update SwiftKit to the latest version simply run:

$ swiftkit update

The update command will only work if SwiftKit is installed via either Mint 🌱 or Homebrew 🍺

Usage 👨‍💻

To create a new Kit simply run:

$ swiftkit new MyAwesomeKit

This will create a new folder in your current directory named by the name of your Kit

To create a Kit inside the current directory simply run:

$ swiftkit new

This will infer the Kit name based on your directory name

If you wish to open the Xcode project after your Kit has been generated simply run:

$ swiftkit new MyAwesomeKit --open

Head over to the Arguments section to learn more about the available arguments

In default SwiftKit will create a Kit that supports iOS, tvOS, watchOS, macOS. If you want to support only certain Targets simply run:

$ swiftkit new MyAwesomeKit --target iOS --target tvOS

This will create a Kit which only supports iOS and tvOS

Kit-Structure 📦

The upcoming sections will explain the structure of your generated Kit in detail.

Xcode Project Structure

In the generated Xcode project you will find four important directories.

Directory Description
Sources Where you place your Swift source files
Tests Place your Unit-Tests files
Example The iOS application example for your Kit
Configs All config files like Plist, Package.swift, Podspec, etc.

Kit.swift

In the aforementioned Sources directory you will find one Swift file which is named by your Kit.

// Include Foundation
@_exported import Foundation

This file is used to inherit the import of Foundation when importing your Kit.

Fastlane

Every generated Kit will come along with a predefined Fastfile.

tests-Lane

The tests lane will run your Unit-Tests.

$ fastlane ios tests
compatibilityTests-Lane

The compatibilityTests lane will verify that your Kit is Carthage, CocoaPods and Swift Package Manager compatible.

$ fastlane ios compatibilityTests

release-lane

The release lane will allow you to automatically release a new version of your Kit.

$ fastlane ios release version:1.1.0

The lane verifies various aspects of your Kit.

Step Description
1 Ensure your are on a clean master branch
2 Run compatibilityTests lane
3 Run tests lane
4 Increment version
5 Add and push Git tag
6 Pushes the Podspec via pod trunk push

☝️ Please ensure you have registered your machine with pod trunk register in order to successfully push the Podspec to CocoaPods

ReadMe

A README.md template file will be automatically created inside your Kit.

The README comes along with typical sections like:

  • Project description
  • Example
  • Installation
  • Usage
  • Contributing
  • License

Please feel free to update the ReadMe to your needs 👍

Environment-Configuration

You can place a JSON environment configuration file in your home directory ~/.swiftkit-env.json to provide default values for:

Key Description
authorName The author name
authorEmail The author email address
organizationName The organization name
organizationIdentifier The organization identifier

SwiftKit will use those values and skip the corresponding CLI questions when running swiftkit new.

{
    "authorName": "Sven Tiigi",
    "authorEmail": "sven.tiigi@gmail.com",
    "organizationName": "Sven Tiigi",
    "organizationIdentifier": "de.tiigi"   
}

Path: ~/.swiftkit-env.json

The environment config values will only be used if no argument for the corresponding value is present.

Arguments

Beside using the CLI inputs SwiftKit supports arguments when launched. The following arguments are supported:

Long parameter Short parameter Description
--target -t The Target that should be included in your Kit 📱
--destination -d Where the generated Kit should be saved 💾
--kit-name -k The name of your Kit 📦
--name -n Your name 👨‍💻
--email -e Your email address 📫
--url -u The repository url 🌎
--ci-service -c The CI-Service 🛠 1 = Travis CI - macOS only 2 = Travis CI - macOS & Linux 3 = GitLab CI 4 = Azure Pipelines 5 = GitHub CI
--organization -o The name of your organization 🏢
--organization-identifier -i The organization identifier 🖋
--repository -r The SwiftKit template repository url 🌎
--force -f Generate the Kit without confirmation ✅
--open -o Open the Xcode project after your Kit has been generated 📂

Example with all arguments been set.

swiftkit new \
	--target iOS \
	--target tvOS \
	--target watchOS \
	--target macOS \
	--destination ~/Desktop/MyAwesomeKit \
	--kit-name MyAwesomeKit \
	--name SvenTiigi \
	--email sven.tiigi@gmail.com \
	--url https://github.com/SvenTiigi/MyAwesomeKit \
	--ci-service 1 \
	--organization SvenTiigi \
	--organization-identifier com.tiigi \
	--repository https://github.com/SvenTiigi/SwiftKit.git \
	--force \
	--open

Featured on

Contributing

Contributions are very welcome 🙌 🤓

Credits

SwiftKit is inspired by SwiftPlate from JohnSundell

License

SwiftKit
Copyright (c) 2020 Sven Tiigi <sven.tiigi@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Github

link
Stars: 757

Used By

Total: 0

Releases

Version 1.3.3 -

Bug fix

Fixed a bug which caused an error during installation via mint or homebrew (https://github.com/SvenTiigi/SwiftKit/issues/6)

Version 1.3.2 -

Xcode 12

Added support for Xcode 12

Version 1.3.1 -

Fixed a bug where the year of the License and Info.plist was not set to the current year.

Version 1.3.0 -

Git init

After your Kit has been generated a Git repo will be automatically initialized with the provided remote URL as origin as well as an initial commit.

GitHub CI support

This Versions adds support for GitHub CI and will let you pick a template GitHub CI YML configuration file.

Improved README generation

The generation of the README.md file has been improved in order to insert a correct url for Swift Package Manager installation instruction.

Fastlane environment file

Added fastlane environment file to disable fastlane auto update.

FASTLANE_SKIP_UPDATE_CHECK=1

Version 1.2.5 -

Environment-Configuration

You can place a JSON environment configuration file in your home directory ~/.swiftkit-env.json to provide default values for:

Key Description
authorName The author name
authorEmail The author email address
organizationName The organization name
organizationIdentifier The organization identifier

SwiftKit will use those values and skip the corresponding console question when running swiftkit new.

{
    "authorName": "Sven Tiigi",
    "authorEmail": "sven.tiigi@gmail.com",
    "organizationName": "Sven Tiigi",
    "organizationIdentifier": "de.tiigi"   
}

Path: ~/.swiftkit-env.json

The environment config values will only be used if no argument for the corresponding value is present.

Custom SwiftKit template repository URL

If you wish to specify any custom SwiftKit repository URL to clone from pass the --repository parameter.

Long parameter Short parameter Description
--repository -r The SwiftKit template repository url 🌎
$ swiftkit new MyAwesomeKit --repository https://github.com/Custom/MyCustomSwiftKit.git

Version 1.2.4 -

GitHub issue templates

This version adds support for GitHub issue template. Your generated Kit will now include a Bug report and a Feature request GitHub issue template.

Bildschirmfoto 2019-05-26 um 16 30 40

Bug fix

This version fixes a bug where the ORGANIZATIONNAME build setting in the project.pbxproj file was not wrapped in quotation marks.

Version 1.2.3 -

CI-Service improvements

carbon

The Travis CI configuration is now available in two variants (https://github.com/SvenTiigi/SwiftKit/issues/3)

  • Travis CI - macOS only
    • Which only uses an macOS image
  • Travis CI - macOS & Linux
    • Which runs on an macOS and Linux image

Additionally this version adds the option to pick an Azure Pipelines CI-Service configuration for your generated Kit.

Compatibility tests lane

The compatibilityTests lane will verify that your Kit is Carthage, CocoaPods and Swift Package Manager compatible.

$ fastlane ios compatibilityTests

Previously the compatibility tests were included in the tests lane

Test-Targets improvements

All Test-Targets of your generated Kit will automatically:

  • Gather Code Coverage
  • Execute in random order
  • Execute parallel

Version 1.2.2 -

Target selection

In default SwiftKit will create a Kit that supports iOS, tvOS, watchOS, macOS. If you want to support only certain Targets simply run:

$ swiftkit new MyAwesomeKit --target iOS --target tvOS

This will create a Kit which only supports iOS and tvOS

Improved Template

Improved template files Package.swift and Fastfile

Version 1.2.1 -

CocoaPods Availability-Check

SwiftKit will show you a warning if the entered Kit name is already taken on CocoaPods.

CocoaPodsAvailability

Template Example iOS App-Icon

Added a predefined App-Icon for the iOS Example Target

Version 1.2.0 -

Improved architecture

SwiftKit has been internally rewritten and is now splitted up in two targets SwiftKit and SwiftKitCLI to allow easier modification and improvements in the future.

Update check

SwiftKit will now inform you about new versions after you generated a new Kit.

Example:

swiftkit new MyAwesomeKit

...

A new version of SwiftKit is available: 1.2.0
To update SwiftKit run: swiftkit update

Update command

To update SwiftKit to the latest version simply run:

$ swiftkit update

The update command will only work if SwiftKit is installed via either Mint 🌱 or Homebrew 🍺

Author mail bugfix

Fixed a bug where the author mail was not correctly migrated

Smarter Organization-Identifier default answer

When providing a custom organization name the first word of the entered organization name will be the second part of the organization identifier inside the default answer.

Example:

🏢  What's your organization name?
(Leave empty to use: MyAwesomeKit)
> Apple Inc.

🖋  What's your organization identifier?
(Leave empty to use com.apple)
>

Version 1.1.0 -

CI-Service

This version will allow you to decide if you would like to use a CI-Service config template. Currently Travis CI and GitLab CI are supported.

Arguments

SwiftKit now supports arguments when launched. Following arguments are supported:

Long parameter Short parameter Description
--destination -d Where the generated Kit should be saved 💾
--project -p The project name of your Kit 🐣
--name -n Your name 👨‍💻
--email -e Your email address 📫
--url -u The repository url 🌎
--ci-service -c The CI-Service 🛠 (1=Travis CI, 2=GitLab CI)
--organization -o The name of your organization 🏢
--organization-identifier -i The organization identifier 🖋
--force -f Generate the Kit without confirmation ✅
--open -o Open the Xcode project after your Kit has been generated 📂

Example with all arguments set.

swiftkit new MyAwesomeKit \
		  	--project MyAwesomeKit \
			--name SvenTiigi \
			--email sven.tiigi@gmail.com \
			--url https://github.com/SvenTiigi/MyAwesomeKit \
			--ci-service 1 \
			--organization SvenTiigi \
			--organization-identifier de.tiigi \
			--force \
			--open

Version 1.0.0 -

Initial Release

This is the first release of SwiftKit