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

Support platform versions back to macOS 10.15, iOS 13.0, tvOS 13.0, and watchOS 6.0 #62

Closed
czechboy0 opened this issue Jun 11, 2023 · 12 comments · Fixed by #63 or apple/swift-openapi-runtime#18
Labels
area/generator Affects: plugin, CLI, config file. area/runtime Affects: the runtime library. area/transport Affects: Client or server transport library. kind/enhancement Improvements to existing feature. 🔨 semver/patch No public API change. size/S Small task. (A couple of hours of work.)

Comments

@czechboy0
Copy link
Contributor

czechboy0 commented Jun 11, 2023

Let's see how much work it'd be to reduce the deployment targets, macOS 13->11, and so on.

This would be all of the repos - generator, runtime, and transports.

// Edit: Possibly we could go as low as .macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6).

@czechboy0 czechboy0 added 🔨 semver/patch No public API change. area/generator Affects: plugin, CLI, config file. area/runtime Affects: the runtime library. area/transport Affects: Client or server transport library. kind/enhancement Improvements to existing feature. size/S Small task. (A couple of hours of work.) labels Jun 11, 2023
@andrewse02
Copy link
Contributor

Hi, I actually did this today! You may have already seen that. It was very simple. There was one instance I found of iOS 16+/macOS 13+ code being used in swift-openapi-runtime. Here's my commit. It was this right here in Converter+Client.swift:

for parameter in parameters {
    renderedString.replace(
        "{}",
        with: parameter.description,
        maxReplacements: 1
    )
}

It was simple enough to wrap this in a if #available. Would you like me to make a PR from my fork?

@simonjbeaumont
Copy link
Collaborator

I think we should be OK to relax the deployment version.

@andrewse02 thanks for looking into it and for offering to put a PR together—that'd be great. 🙌

@denil-ct
Copy link
Contributor

denil-ct commented Jun 12, 2023

I was thinking of reducing it to iOS 12 as one of our apps still had 12 as the deployment target, and it was easy to change it for the generator and runtime. But for the transport since there is no concurrency support, I've hit a roadblock :(
Till iOS 13, there aren't any major issues, so I think we can reduce it to even iOS 13.
I have opened a PR for url session transport here.

If I need to use it in a iOS 12 environment is it doable in some other way? Maybe with the new macros can we make it generate both the completion style and async/await styles for the client.send method?

@czechboy0
Copy link
Contributor Author

@andrewse02 Since @denil-ct was able to reduce the URLSession transport's deployment target by 3 versions in apple/swift-openapi-urlsession#7, can you try to do the same for the runtime and generator as well? It's okay if transports are more restrictive, as they're usually more tied to specific platform features, but if it's less restrictive, then adopters won't be able to use it anyway (due to the runtime package requiring a higher deployment target).

So let's try to go for the following: .macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6).

@denil-ct If you'd like, you could try a similar PR in https://github.com/swift-server/swift-openapi-async-http-client

@czechboy0 czechboy0 changed the title Investigate reducing the deployment targets by 2 versions Investigate reducing the deployment targets by 3 versions Jun 12, 2023
@denil-ct
Copy link
Contributor

Sure @czechboy0, will check it out.

@andrewse02
Copy link
Contributor

Sure @czechboy0, I'll get on that!

@Lucas-Quinn-1163273
Copy link

I tried this yesterday, although the documentation isn't that good. However, after reading the source code, I was able to make it work fine. Great job! There's just one thing preventing our company from adopting it: if possible, please lower it to at least iOS 15.0, which is the highest version many devices can get.

Additionally, iOS 15.0 (90.9% adoption) would be much safer than 16.0 (74.9% adoption) in terms of current user adoption. But if there is no difficulty in lowering it to iOS 13.0, that would be even better.

@simonjbeaumont
Copy link
Collaborator

@lucas-quinn wrote:

Great job! There's just one thing preventing our company from adopting it: if possible, please lower it to at least iOS 15.0, which is the highest version many devices can get.

Additionally, iOS 15.0 (90.9% adoption) would be much safer than 16.0 (74.9% adoption) in terms of current user adoption. But if there is no difficulty in lowering it to iOS 13.0, that would be even better.

Thanks for adding your datapoint here. It looks like the current plan (in flight) is to drop to minimum of iOS 13 so that should suit you :)

I tried this yesterday, although the documentation isn't that good. However, after reading the source code, I was able to make it work fine.

We'd love to understand how we could improve the documentation. Could you elaborate on what was missing and forced you to inspect the code? 🙏

@czechboy0
Copy link
Contributor Author

cc @adam-fowler @0xTim for the Hummingbird and Vapor transports, in case you also want to reduce the deployment target (once apple/swift-openapi-runtime#18 lands and is tagged).

simonjbeaumont pushed a commit to apple/swift-openapi-runtime that referenced this issue Jun 13, 2023
#18)

### Motivation

Reduce deployment target by 3 versions to gain more adoption.

### Modifications

- Reduced deployment targets by 3 versions
- Modified `Converter#renderedRequestPath` to support iOS 13

### Result

Deployment target will be reduced by 3 versions.

### Related issues

- Related to apple/swift-openapi-generator#62

### Related PRs

- Paired with apple/swift-openapi-generator#63

---------

Co-authored-by: andrewelliott <>
Co-authored-by: Honza Dvorsky <[email protected]>
@czechboy0
Copy link
Contributor Author

Reopening until the generator and URLSession/AHC transports are updated as well.

@czechboy0 czechboy0 reopened this Jun 13, 2023
@denil-ct
Copy link
Contributor

I guess we can close this? @czechboy0

@czechboy0
Copy link
Contributor Author

Runtime, URLSession, and AHC have been released, but not this repo yet: #63 - let's wait for that before we close this issue.

@simonjbeaumont simonjbeaumont changed the title Investigate reducing the deployment targets by 3 versions Support platform versions back to macOS 10.15, iOS 13.0, tvOS 13.0, and watchOS 6.0 Jun 13, 2023
simonjbeaumont pushed a commit that referenced this issue Jun 13, 2023
### Motivation

Reduce deployment target by 3 versions to gain more adoption.

### Modifications

- Reduced deployment targets by 3 versions
- Modified `client.Package.x` and `server.Package.x` files to reflect
new deployment targets
- Modified documentation to reflect new deployment targets

### Result

Deployment target will be reduced by 3 versions and documentation will
reflect such changes.

### Resolves

- Resolves #62

### Related PRs

- Paired with apple/swift-openapi-runtime#18

---------

Co-authored-by: andrewelliott <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/generator Affects: plugin, CLI, config file. area/runtime Affects: the runtime library. area/transport Affects: Client or server transport library. kind/enhancement Improvements to existing feature. 🔨 semver/patch No public API change. size/S Small task. (A couple of hours of work.)
Projects
None yet
5 participants