generative-ai-swift
generative-ai-swift copied to clipboard
Add support to watchOS from 4.0
Description of the change
I changed the files to also run if on watchOS 7.0+
Motivation
So this can be used on watchOS.
Type of change
Not sure what it counts as?
Checklist
- [x] I have performed a self-review of my code.
- [x] I have added detailed comments to my code where applicable.
- [x] I have verified that my change does not break existing code.
- [x] My PR is based on the latest changes of the main branch (if unsure, please run
git pull --rebase upstream main). - [x] I am familiar with the Google Style Guide for the language I have coded in.
- [x] I have read through the Contributing Guide and signed the Contributor License Agreement.
Thanks for the PR, @rin-senpai! Before you proceed any further though, I'll need to discuss with my team about whether we want to support an additional platform going forward. I'd also need to verify that our networking code works on a real Apple Watch, rather than the watchOS simulator.
I've added the platform in the package.swift file (it's v8 because seems like that's needed for some things).
I could probably also lower that v8 to v7 or lower and require 8.0 where needed, and also remove all the watchOS 7.0s that aren't needed to clean things up, so I'll do that later when I have time.
@andrewheard I've done the changes I mentioned above and there are no issues with building other than this thing which I is confusing me a little:
The functions are supported from watchOS 2.0 but I also tried requiring watchOS 8.0 and also higher versions on this and the ThrowingPartsRepresentable function so I'm not sure why it's not in scope assuming it does usually work? Maybe I'm missing something simple...
@andrewheard I've done the changes I mentioned above and there are no issues with building other than this thing which I is confusing me a little:
The functions are supported from watchOS 2.0 but I also tried requiring watchOS 8.0 and also higher versions on this and the ThrowingPartsRepresentable function so I'm not sure why it's not in scope assuming it does usually work? Maybe I'm missing something simple...
Hi @rin-senpai, despite the documentation for CGImageDestinationCreateWithData(_:_:_:_:) stating watchOS 2+, I also saw the same errors as you. If I recall correctly, I was able to resolve the error 'nil' requires a contextual type by changing nil to nil as CFDictionary? but it didn't resolve the other functions not being in scope. I think it would be reasonable to remove this extension from watchOS builds using #if !os(watchOS).
That said, I just want to reiterate from before:
I'll need to discuss with my team about whether we want to support an additional platform going forward. I'd also need to verify that our networking code works on a real Apple Watch, rather than the watchOS simulator.
This issue is one example of the maintenance burden of an additional platform. cc: @ryanwilson
Yes of course I do understand the maintenance burden, and no rush on making a decision there. I'm just making sure it actually works if the team decides to go through with this, and even if not I'll be maintaining my own fork anyway. I'll look into the aforementioned issue more later, as I do recall watchOS supporting CGImage, but if things don't work out I'll just remove the extension as you have said. Thanks!
Hey @andrewheard! Finally got around to fixing this and in my latest commit the CGImage build error is fixed and I can confirm it works. I've tested basic things such as image and text generation, and there doesn't seem to be any issues so in the interest of my time I'll probably leave it at that for the moment. If there are any style issues for me to address I'll do so sometime in the next few weeks. I know the team may decide the maintenance burden is too high, but just wanted to update you.
hey is there an update on this?
Hi @rin-senpai, unfortunately we don't currently have plans to support watchOS in this SDK in the near term. As a potential alternative, I've added basic watchOS support in the Vertex AI in Firebase SDK. The API surface is quite similar and we have a migration guide here: https://firebase.google.com/docs/vertex-ai/migrate-to-vertex-ai?platform=ios
The functions are supported from watchOS 2.0 but I also tried requiring watchOS 8.0 and also higher versions on this and the ThrowingPartsRepresentable function so I'm not sure why it's not in scope assuming it does usually work? Maybe I'm missing something simple...