Closed fishercraigj closed 4 years ago
You’re trying to build SwiftLint for iOS, but that’s not a supported OS. SwiftLint only runs on macOS & Linux.
You’re trying to build SwiftLint for iOS, but that’s not a supported OS. SwiftLint only runs on macOS & Linux.
That's so completely untrue @jpsim. I have it installed on multiple projects but installed through cocoapods. The problem is SourceKitten which is one of their dependencies as listed above.
Based on information provided, that's the best guess I can make.
Notably, the screenshot you shared includes the compiler error message: 'sortedKeys' is only available in iOS 11.0 or newer
If you share more complete steps that you took to install SwiftLint, I may be able to provide better guidance as to what is going wrong. and how to fix it.
@jpsim - There's no special hidden steps.
1) open xcode 2) install SwiftLint 0.36.0 in SPM 3) build 4) you get an error
I'm sorry those steps don't surface any errors for me. It really seems to me like you're attempting to build SwiftLint for an iOS target. Are you sure that's not what you're doing?
I took a few minutes to record myself creating a new Xcode project, adding SwiftLint 0.36.0 as a dependency via SwiftPM, building and running that sample app and confirmed that everything worked as expected. Could you please take a look at the attached video to perhaps identify what you're doing differently?
Hi, @jpsim. I have the same issue. I've tried with a new project for iOS, and it repeats.
Again, SwiftLint requires SourceKit to run, which is only available on Linux and macOS. iOS is not supported to build or run SwiftLint.
Pretty confused why this ticket got closed. SwiftLint runs fine if you run it through cocoapods so to say that it doesn't work on iOS is a bit puzzling. Is the cocoapod and swiftpackage manager running different dependencies?
@fishercraigj did you review my last comment and the video that I shared?
Is the cocoapod and swiftpackage manager running different dependencies?
Yes, the CocoaPods podspec for SwiftLint
simply vends the macOS binary for SwiftLint: https://github.com/realm/SwiftLint/blob/0.37.0/SwiftLint.podspec#L8
This has allowed users to add SwiftLint to their CocoaPods-managed iOS project in the same way they add dependencies to their iOS binary, but without checking in the SwiftLint binary or framework into their app.
The CocoaPods podspec for SwiftLintFramework
is closer to what you get by adding SwiftLint as a Swift Package Manager dependency, which always builds the framework from source, which is only supported on macOS and Linux because those are all the platforms that have SourceKit: https://github.com/realm/SwiftLint/blob/0.37.0/SwiftLintFramework.podspec
@fishercraigj Hello from the future! To answer this for anyone who finds it: Just add via SPM and uncheck the "add to target" box and your project will compile. @jpsim IMO the front page integration docs should include this as it's stupid simple and xcode defaults to checking that box which of course breaks it.
Meanwhile, still trying to get SPM SwiftLint to actually execute again after every build 😂
After reading @jpsim (11 Nov 2019 ) and @RamblinWreck77 (7 Dec 2020) comments I realized that when adding SwiftLint using Swift Package Manager, for iOS project I had to remove SwiftLintFramework from the Frameworks, Libraries and Embedded Content in target's General tab.
New Issue Checklist
Describe the bug
I'm on Catalina, Xcode 11.1. I can install the SwiftLint 0.36.0 swift package but when I do I get errors out of some of your dependences (SourceKitten). See screenshot for reference.