Skip to content

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

Closed
@drekka

Description

@drekka

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugFeature doesn't work as expected.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions