Xcode-beta (8S193k): Xcode Plugin Template in Swift contains numerous errors

Originator:designatednerd
Number:rdar://27841936 Date Originated:14-Aug-2016 09:42 PM
Status:Closed Resolved:User error
Product:Developer Tools Product Version:Xcode-beta (8S193k)
Classification:Serious Bug Reproducible:Always
 
Summary:
In Xcode 8b5, there are numerous errors with the code for the plugin itself and the xcodeproj file when trying to build an Xcode Plugin file. 

Steps to Reproduce:
1. Create new xcode plugin project. 
2. Notice rdar://27841858, switch to secondary scheme
3. Receive error: 

Check dependencies

“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

4. Update “Use Legacy Swift Language Version” to Yes. Build app. 
5. Receive 2 compiler warnings about use of string literal selectors being deprecated
6. Receive warning about updating your project to recommended project settings, even though you *just* created this project.
7. Receive compiler error about force-unwrapping a non-optional on NSMenu
8. Fix error. Build app. 
9. Receive 2 more compiler warnings about use of var instead of let for items which are never mutated. 


Expected Results:
- Plugin builds out of the box on all schemes without warnings, errors or settings update recommendations
- Plugin template uses non-deprecated syntax
- Plugin uses lets instead of vars where appropriate

Actual Results:
- Plugin won’t build on valid scheme until a value for “Use legacy swift language version” is selected
- Plugin template uses string literal selector syntax instead of #selector syntax
- Plugin template uses vars several places where lets should be used. 

Regression:
Hadn’t tried this in earlier betas because I am a horrendous procrastinator. 

Notes:
I’ve attached a project I’m working on - the INTERPOL.swift file is essentially my suggestion for how the template file should be refactored.

Comments

This was closed as invalid (and I eventually realized this was a PEBKAC issue, I totally opened an old Xcode Plugin template instead of the new Xcode Extension template).

By designatednerd at Sept. 6, 2016, 10:36 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!