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

Xcode 13, DocC #86

Merged
merged 12 commits into from
Jan 4, 2022
Merged

Xcode 13, DocC #86

merged 12 commits into from
Jan 4, 2022

Conversation

vtourraine
Copy link
Owner

@vtourraine vtourraine commented Aug 4, 2021

  • Fix compatibility with latest SPM build process in Xcode 13 (i.e. use App Extension compatible APIs only)
  • Add DocC resources

@vtourraine vtourraine changed the title Xcode 13 support Xcode 13, DocC Aug 4, 2021
@melle
Copy link
Contributor

melle commented Aug 5, 2021

Problem

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.

Steps to reproduce:

  • include AcknowList via SPM .package(name: "AcknowList", url: "https://github.com/vtourraine/AcknowList.git", .branch("xcode-13"))
  • build the project for Any iOS Device (arm64)

Workaround:

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.

@vtourraine
Copy link
Owner Author

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?

melle added a commit to teufelaudio/AcknowList that referenced this pull request Aug 5, 2021
@melle
Copy link
Contributor

melle commented Aug 5, 2021

I wonder why wrapping the SwiftUI code in #if canImport(SwiftUI) is not working.

@vtourraine
Copy link
Owner Author

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).

@vtourraine vtourraine merged commit 9e8f343 into main Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants