Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

SwiftFrameworkTemplate

> 包管理
Open source

A template for new Swift iOS / macOS / tvOS / watchOS Framework project ready with travis-ci, cocoapods, Carthage, SwiftPM and a Readme file

525 stars0 likes0 views
WebsiteGitHub

About

A template for new Swift iOS / macOS / tvOS / watchOS Framework project ready with travis-ci, cocoapods, Carthage, SwiftPM and a Readme file

Swift Framework Template

A template for new Swift Framework.

What's in the template?

  • Deployment Targets - iOS 9.0 / Mac OS X 10.10 / tvOS 9.0 / watchOS 2.0
  • Xcode 10
  • Swift 4.2
  • Dependency Managers - CocoaPods / Carthage / Swift Package Manager
  • Readme
  • SwiftFormat
  • Dangerfile / Gemfile / Jazzy
  • Github Templates (CODE_OF_CONDUCT, CONTRIBUTING, ISSUE_TEMPLATE, PULL_REQUEST_TEMPLATE)
  • TravisCI
  • MIT LICENSE
  • Testing Dependencies - Quick and Nimble

Usage

  1. Install carthage (brew install carthage on macOS).
  2. Install cookiecutter (brew install cookiecutter on macOS).

Xcode 10

  • Run cookiecutter -c xcode10 https://github.com/RahulKatariya/SwiftFrameworkTemplate

Xcode 9

  • Run cookiecutter -c xcode9 https://github.com/RahulKatariya/SwiftFrameworkTemplate

For future runs you can shorten the command to cookiecutter SwiftFrameworkTemplate. However, if you want to use the most recent template you should still run the full command above.

Additional instructions

This template attempts to provide you an easy setup of your framework repository with many third-party services, however some of them require additional steps such as register and authentication. Below you can find instructions in case this is the first time you set any of these:

CocoaPods

If this is the first time submitting to CocoaPods a framework named like yours, you need to register your e-mail to CocoaPods system in order to receive owner access to it. You can do so using the following command:

bash
$ pod trunk register [email protected] --description='My Mac'

Make sure to replace [email protected] by a valid email since the next step is to access a verification link that CocoaPods is going to send to that address.

The register process will install a token to your machine which can be read with the following command:

bash
$ grep -A2 'trunk.cocoapods.org' ~/.netrc
machine trunk.cocoapods.org
  login [email protected]
  password ef9bb4c41a4459ba92645a85b3c9cd88

If you're using this template, the CocoaPods deploy commands are already in your .travis.yml file, so all you need now is to make sure the Travis CI machines are able to use that token. In order to do it securely, we recommend to do it by setting an environment variable and not allowing its value to be displayed in build logs.

In your repository build settings on Travis, add an environment variable named COCOAPODS_TRUNK_TOKEN with value ef9bb4c41a4459ba92645a85b3c9cd88 - replacing this value by the password you've obtained from ~/.netrc

References:

  • Automated CocoaPod releases with CI

  • Publishing to CocoaPods from Travis

    GitHub releases

In order to have the Travis CI submitting archives to the Releases tab in your framework's GitHub page, you need to adjust .travis.yml with your personal access token.

An easy way to obtain this token is by using the travis gem. You can install it and obtain a token with the following command, which will prompt you with a few questions and automatically modify your .travis.yml file:

bash
$ gem install travis && travis setup releases
Detected repository as /, is this correct? |yes|
Username: 
Password for : ************
File to Upload: 
Deploy only from /? |yes|
Encrypt API key? |yes|

If you're using this template, part of these questions are not necessary for you, and the changes to .travis.yml will be mostly unhelpful, however among the changes you'll find this:

…

Using this template, you can revert all changes created by travis, but save the generated base64 512 bytes secure key from the previous step before doing so, and add it to your .travis.yml at the corresponding spot.

References:

  • Adding GitHub token to Travis CI configuration
  • How to use encrypted api keys for github release deployment

Built With SwiftFrameworkTemplate

  • Restofire
  • RxCoreLocation
  • RxCocoaNetworking

Credits

Some of the ideas and wording for the statements above were based on work by the Alamofire and ReactiveCocoa communities. We commend them for their efforts.

Contributing

Issues and pull requests are welcome!

Author

Rahul Katariya @rahulkatariya91

License

SwiftFrameworkTemplate is released under the MIT license. See LICENSE for details.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rubycarthagecocoapodscookiecutterframework

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category包管理
PricingOpen source

> Related tools

N
npm
Node.js 默认包管理器
P
pnpm
高效节省磁盘的 Node 包管理器
I
is-gif
Check if a Buffer/Uint8Array is a GIF image