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

@available for iOS12, but uses types from iOS13. #122

Closed
drekka opened this issue Jun 22, 2022 · 4 comments
Closed

@available for iOS12, but uses types from iOS13. #122

drekka opened this issue Jun 22, 2022 · 4 comments
Labels
kind/bug Feature doesn't work as expected.

Comments

@drekka
Copy link

drekka commented Jun 22, 2022

I'm trying to use the Hummingbird server as a test server for UI testing. After adding Hummingbird and trying to compile I'm getting a series of compilation errors from the swift-service-lifecycle code. One of which looks like this:

checkouts/swift-service-lifecycle/Sources/Lifecycle/Lifecycle.swift:103:13: error: 'Task' is only available in iOS 13.0 or newer
            Task {
            ^

Looking at Lifecycle.swift I can see this code:

#if compiler(>=5.5) && canImport(_Concurrency)
@available(macOS 12.0, *)
extension LifecycleHandler {
    public init(_ handler: @escaping () async throws -> Void) {
        self = LifecycleHandler { callback in
            Task {
                do {
                    try await handler()

Now if I'm reading this right, it's saying that it should be available for iOS12 (which is what this project is still supporting :-( ) but it's using Task which only came with iOS13 as the error indicates.

How do I fix this?

@ktoso
Copy link
Contributor

ktoso commented Jun 22, 2022

That would be a bug in the availability annotation here actually - we should fix that.

We should use @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) I can send in a PR about this.

@ktoso ktoso added the kind/bug Feature doesn't work as expected. label Jun 22, 2022
@ktoso
Copy link
Contributor

ktoso commented Jun 22, 2022

Huh wait, these are actually already correct on main: https://github.com/swift-server/swift-service-lifecycle/blob/main/Sources/Lifecycle/Lifecycle.swift#L173

#if canImport(_Concurrency) && compiler(>=5.5.2)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
extension LifecycleStartHandler {

This was done in #118

we're just missing a release from 2022 :-)

@tomerd would you want to do the tag here, just in case there's anything else you'd like to do at the same time?

@tomerd
Copy link
Contributor

tomerd commented Jun 22, 2022

published 1.0.0-alpha.11

@tomerd tomerd closed this as completed Jun 22, 2022
@drekka
Copy link
Author

drekka commented Jun 23, 2022

Awesome response guys. All working over here. Thanks you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Feature doesn't work as expected.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants