16

GitHub - SvenTiigi/SwiftKit: Start your next Open-Source Swift Framework ?

 5 years ago
source link: https://github.com/SvenTiigi/SwiftKit
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

SwiftKit Header Logo

Swift 5.0 Version Documentation Mint brew Twitter


SwiftKit enables you to easily generate a cross platform Swift Framework from your command line.
It is the best way to start your next Open-Source Swift Framework ?.
SwiftKit is inspired by SwiftPlate


SwiftKit Terminal Demo

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 (Travis, GitLab)

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

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 flags

Kit-Structure ?

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

Xcode Logo

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.

Swift File Logo

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 Logo

Fastlane

Every generated Kit will come along with a predefined Fastfile.

tests-Lane

The tests lane will run your Unit-Tests and verify that your Kit is Carthage and CocoaPods compatible.

$ fastlane ios tests

release-lane

The release lane will allow you to automatically release a new version of your Kit for Carthage/GitHub and CocoaPods.

$ 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 tests lane 3 Increment version 4 Add and push Git tag 5 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

Markdown Logo

ReadMe

A README.md template will be automatically created inside your Kit. It contains default sections like Example, Installation and Usage. Please feel free to update the ReadMe to your needs.

Template ReadMe

Arguments

SwiftKit 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 [email protected] \
			--url https://github.com/SvenTiigi/MyAwesomeKit \
			--ci-service 1 \
			--organization SvenTiigi \
			--organization-identifier de.tiigi \
			--force \
			--open

Contributing

Contributions are very welcome ??

Credits

SwiftKit is inspired by SwiftPlate from JohnSundell

License

SwiftKit
Copyright (c) 2019 Sven Tiigi <[email protected]>

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.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK