Closed vtourraine closed 2 years ago
I noticed build errors on Xcode 12.5 when building my project for Any iOS Device (arm64)
like the Archive step does.
AcknowList is included via SPM:
.package(name: "AcknowList", url: "https://github.com/vtourraine/AcknowList.git", .branch("xcode-13")),
It looks like SwiftUI is not available:
AcknowList/Sources/AcknowList/AcknowListSwiftUI.swift:72:24: cannot find type 'View' in scope
var body: some View {
^~~~~~~
However, AcknowListSwiftUIView is guarded by @available(iOS 13.0.0, macOS 10.15.0, watchOS 7.0.0, tvOS 13.0.0, *)
so I don't understand why this is a problem.
.package(name: "AcknowList", url: "https://github.com/vtourraine/AcknowList.git", .branch("xcode-13"))
Any iOS Device (arm64)
Require iOS 13 for AcknowList:
--- a/Package.swift
+++ b/Package.swift
@@ -6,7 +6,7 @@ let package = Package(
name: "AcknowList",
defaultLocalization: "en",
platforms: [
- .iOS(.v9), .tvOS(.v9), .watchOS(.v7), .macOS(.v10_15)
+ .iOS(.v13), .tvOS(.v9), .watchOS(.v7), .macOS(.v10_15)
],
I assume this is not a viable solution as the most users stick with older iOS versions.
Oh... you’re right. I hadn’t tested “Archive” since adding the SwiftUI classes. And I don’t understand either why the @available
statements don’t solve that. That’s really unfortunate.
There can only be one Package.swift
by repository, so we can’t even define an alternate package to satisfy both cases.
If we can’t find a solution, I think I would set the platform requirement at iOS 13 for SPM, and explain in the README that you can support earlier versions by using CocoaPods or importing the library manually. But that’s not great.
Any Swift compiler magician out there who could help us with this?
I wonder why wrapping the SwiftUI code in #if canImport(SwiftUI)
is not working.
Finally resigned myself to the solution of requiring iOS 13, just to make sure the SwiftUI code is supported. Not ideal, but it looks like the only way forward (manual integration is always possible for older versions).