Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift: What is a .swift-version file?

Tags:

I see a lot of projects have this file in their root directory:

.swift-version

These are some examples:

https://github.com/hackiftekhar/IQKeyboardManager

https://github.com/Alamofire/Alamofire

https://github.com/TheMindStudios/SwiftyPlayer

My question is what is the purpose of this file and what is it used for?

like image 736
etayluz Avatar asked Sep 20 '16 06:09

etayluz


1 Answers

This seems quite similar to the practice of a .ruby-version file which instructs a version manager like rvm to pick up a particular version of ruby. But what it's doing in case of swift, I am not really sure. Here are two related scenarios that I have come across:

  1. It seems that this flag is used by the cocoapods to set some target level settings on pods. Refer:

Cocoapods issue

This cocoapod pull request can also provide some clue

  1. Another place I have come across it is swiftenv. This is quit like rvm (or say nvm) which can help you manage multiple versions of swift.

This is not an exact answer. But I hope it provides some information.

like image 178
ArG Avatar answered Sep 26 '22 20:09

ArG