Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update minimum supported Swift version to Swift 5.7 #1837

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

calda
Copy link
Collaborator

@calda calda commented Aug 26, 2024

Based on the current set of CI jobs, SwiftFormat currently supports a minimum Swift version of Swift 5.2, which was released in Feb 2020.

In #1832, we had been talking about using multiple-trailing-closure syntax for a new feature. Multiple trailing closures were introduced in Swift 5.3, so to use this approach we have to update the minimum supported Swift version.

@nicklockwood, what are your general thoughts on what Swift versions should be supported by SwiftFormat?

We could just update to Swift 5.3+, which would lets us use trailing closures. I personally like the sound of Swift 5.7, since it adds a lot of extra functionality that we're missing in Swift 5.2 while still being somewhat older (released in September 2022).

@nicklockwood
Copy link
Owner

Historically, the reason for wanting to keep the codebase building on very old versions was due to a quirk of how people integrated SwiftFormat into their projects.

They either had to build it locally on their dev machine, or if they were using Cocoapods to install the binary then even though it was precompiled they were still limited to whatever version the podfile said was needed to build it.

Since we don't have any analytics about which Xcode versions people are using it's difficult to tell what's safe. I guess an option would be to just bump the version to 5.7 for the next release, but without adopting any features into the code yet, and then see if anyone raises a ticket about it? If so we can roll the min version back in a point release.

@calda
Copy link
Collaborator Author

calda commented Aug 29, 2024

That makes sense and sounds reasonable.

It would be nice to be able to land #1832, which requires Swift 5.3+.

What if we do this:

  1. Drop support for Swift 5.2 now, require Swift 5.3+
  2. Merge Move rule examples below rule implementation #1832 which requires Swift 5.3
  3. In the next release, bump the minimum Swift version to Swift 5.7
  4. If issues come up, we can roll back to Swift 5.3.

What do you think @nicklockwood?

Also, how should we do #3? If we update develop now, the code will inevitably stop compiling with the Swift versions we dropped. I guess that's ok though, since any issues would be easy enough to fix by hand later if necessary. We could avoid changing the --swiftversion to 5.7 for now to reduce the number of incompatible changes.

@nicklockwood
Copy link
Owner

@calda sorry for the delayed response. I'd suggest doing this in two steps:

  1. bump the min version to 5.3 and land the examples change
  2. (as a separate PR) bump the minimum version to 5.7 but don't update the code with any 5.7-specific features

If no issues arise during the SwiftFormat 0.55.x release cycle we can update the formatting version and start using 5.7-specific features in the codebase, but otherwise we'll roll back to 5.3 for now

@calda calda changed the title Update minimum supported Swift version Update minimum supported Swift version to Swift 5.3 Aug 31, 2024
@calda
Copy link
Collaborator Author

calda commented Aug 31, 2024

I see you did the Swift 5.3 update in b3b2610, thanks!

@calda calda changed the title Update minimum supported Swift version to Swift 5.3 Update minimum supported Swift version to Swift 5.7 Aug 31, 2024
@calda calda marked this pull request as draft August 31, 2024 14:07
@nicklockwood nicklockwood force-pushed the develop branch 12 times, most recently from 8d6e356 to 34167b2 Compare September 7, 2024 06:58
@nicklockwood nicklockwood force-pushed the develop branch 7 times, most recently from 674a825 to 3f947f6 Compare September 15, 2024 08:10
@nicklockwood nicklockwood force-pushed the develop branch 3 times, most recently from f5ec52c to 1b53343 Compare September 22, 2024 12:32
@nicklockwood nicklockwood force-pushed the develop branch 11 times, most recently from cae4d67 to f36187b Compare November 27, 2024 00:00
@nicklockwood nicklockwood force-pushed the develop branch 2 times, most recently from 8b0b9d0 to a608072 Compare December 16, 2024 18:15
@nicklockwood nicklockwood force-pushed the develop branch 4 times, most recently from f9e5a79 to 112174a Compare December 22, 2024 16:09
@nicklockwood nicklockwood force-pushed the develop branch 7 times, most recently from 1389c1e to 19bf26c Compare January 21, 2025 00:16
@calda calda force-pushed the cal--update-minimum-swift-version branch from dbd22c8 to c538be7 Compare February 1, 2025 22:28
@calda calda marked this pull request as ready for review February 1, 2025 22:31
@calda
Copy link
Collaborator Author

calda commented Feb 1, 2025

@nicklockwood, last time we chatted about this you said:

I'd suggest doing this in two steps:

  • bump the min version to 5.3 and land the examples change
  • bump the minimum version to 5.7 but don't update the code with any 5.7-specific features

If no issues arise during the SwiftFormat 0.55.x release cycle we can update the formatting version and start using 5.7-specific features in the codebase, but otherwise we'll roll back to 5.3 for now

We didn't end up updating to Swift 5.7 for 0.55. How about we update to Swift 5.7 in 0.56, and then if nothing comes up we can update the .swiftformat config to 5.7 and start adopting 5.7+ features a few months after that? Does that work?

Repository owner deleted a comment from codecov bot Feb 1, 2025
Copy link

codecov bot commented Feb 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.51%. Comparing base (2d14301) to head (c538be7).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1837      +/-   ##
===========================================
- Coverage    95.51%   95.51%   -0.01%     
===========================================
  Files          139      139              
  Lines        25590    25590              
===========================================
- Hits         24443    24442       -1     
- Misses        1147     1148       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants