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

Flutter support for Apple Watch #28901

Open
vijayredme opened this issue Mar 5, 2019 · 42 comments
Open

Flutter support for Apple Watch #28901

vijayredme opened this issue Mar 5, 2019 · 42 comments
Labels
customer: crowd Affects or could affect many people, though not necessarily a specific customer. engine flutter/engine repository. See also e: labels. P3 Issues that are less important to the Flutter project platform-ios iOS applications specifically team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team

Comments

@vijayredme
Copy link

vijayredme commented Mar 5, 2019

Latest status: #28901 (comment)


is it possible to create a watchOS application with flutter ?

@Gorniv
Copy link

Gorniv commented Jun 11, 2019

wait #15288

@jmagman jmagman added c: new feature Nothing broken; request for a new capability documentation needed labels Aug 9, 2019
@jmagman

This comment has been minimized.

@jmagman jmagman removed the c: new feature Nothing broken; request for a new capability label Aug 9, 2019
@ilkkanisula
Copy link

#15288 is closed now. Is there some basic instructions available so I can test to build simple flutter app for watchOS simulator?

@peazz
Copy link

peazz commented Oct 7, 2019

bump

I went through, cleaned up my plugins and enabled bitcode support throughout the project, I still get errors saying that flutter cannot be found and that its not supported.

@zeucxb

This comment has been minimized.

@peazz
Copy link

peazz commented Dec 22, 2019

You can write a native apple watch app and you can communicate with flutter via streams, you do have to link up the app yourself but it can be done.

@sebastianpicklum
Copy link

But that’s not a Flutter app on the Watch.

Flutter should run on an Apple Watch as AFAIK everything it needs to run on iOS is available also in watchOS.

I’ve already developed an application for watchOS with SwiftUI and I was quite impressed on how well it performs without draining the battery. So I think Flutter will also perform quite well on watchOS as it has many similarities with SwiftUI.

@nelsonic
Copy link

@peazz can please you share a bit more detail on how you would link a Flutter iOS App with a Watch OS App (written in Swift) using streams? Do you know of any examples in the App Store where the devs have done this so we can test out the UX of both? (Thanks!)

Obviously this thread is for adding Apple Watch support to Flutter and that will be amazing,
but until that happens, we need to understand if the intermediate step is workable.

@sebastianpicklum
Copy link

It’s done the same way a native iPhone app is linked with a Watch app. You just use streams to route payloads from/to Flutter.

@zoeyfan zoeyfan changed the title Flutter support for Apple Watch Flutter documentation support for Apple Watch Jan 3, 2020
@iapicca iapicca added customer: crowd Affects or could affect many people, though not necessarily a specific customer. e: device-specific Only manifests on certain devices passed first triage t: xcode "xcodebuild" on iOS and general Xcode project management platform-ios iOS applications specifically labels Jan 14, 2020
@kf6gpe kf6gpe added framework flutter/packages/flutter repository. See also f: labels. tool Affects the "flutter" command-line tool. See also t: labels. labels Jan 27, 2020
@kf6gpe
Copy link
Contributor

kf6gpe commented Jan 27, 2020

I think this likely needs some documentation help from both the framework and tool teams --- assigning appropriate labels. Feel free to re-label if I'm wrong..

@jmagman
Copy link
Member

jmagman commented Jan 27, 2020

To support a real Flutter watch app, there's more than documentation work to be done. The engine would need to create a version of the Flutter framework APIs that links on and subclasses WatchKit or SwiftUI instead of UIKit, similar to the FlutterMacOS.framework version that links on AppKit for macOS.

Figuring out bitcode was blocking that work, I believe. @dnfield Does that all sound right?

@jmagman jmagman added this to Awaiting triage in Tools - engine support review via automation Jan 27, 2020
@jmagman jmagman changed the title Flutter documentation support for Apple Watch Flutter support for Apple Watch Jan 27, 2020
@dnfield
Copy link
Contributor

dnfield commented Jan 27, 2020

Yes - the bitcode piece should not be a blocker anymore, but there still needs to be embedding code written for WatchKit.

AFAIK, this is not on anyone's radar actively. But it should be possible to do.

@kattaliraees

This comment has been minimized.

@jmagman

This comment has been minimized.

@otopba

This comment was marked as off-topic.

@diegogarciar
Copy link

Hi! I have a question: Why do we have to set bitcode when adding Apple Watch app?
I have been developing a watch app with no problem. Haven't distributed though.

@jmagman
Copy link
Member

jmagman commented Jan 6, 2022

Hi! I have a question: Why do we have to set bitcode when adding Apple Watch app? I have been developing a watch app with no problem. Haven't distributed though.

Apple will reject your app if ENABLE_BITCODE=NO for the watch target, or if you are linking against a framework that does not have bitcode enabled.

@yura2000

This comment has been minimized.

@ilkkanisula

This comment has been minimized.

@yura2000

This comment has been minimized.

@ricardoboss

This comment was marked as duplicate.

@jmagman

This comment was marked as duplicate.

@ciriousjoker

This comment was marked as duplicate.

@jmagman
Copy link
Member

jmagman commented Oct 25, 2022

There is no update. When there is an update someone will likely comment on this issue. Please just 👍 to be subscribed to notifications instead of adding noise.

@gilaraujo
Copy link

Apple will reject your app if ENABLE_BITCODE=NO for the watch target, or if you are linking against a framework that does not have bitcode enabled.

Now that bitcode is no longer required for watchOS applications, is there any other requirement that prevents flutter from supporting WatchOS?

Thanks in advance!

@jmagman
Copy link
Member

jmagman commented Jan 17, 2023

A similar question was asked about tvOS, my answer at #47928 (comment) is also applicable to watchOS. Substitute "tv" with "watch" as you read 🙂

It would involve code changes in the buildroot, and some changes to Dart and Skia (if we aren't totally off Skia and onto Impeller by then).

Most of the work would be adding an entirely new embedder in the engine, as well as test harnesses. We are working on some refactoring in the Flutter engine that should, in theory, allow more code to be shared between macOS, iOS, and future embedders like tvOS or watchOS. I would also expect some new fresh gotchas around platform view and threading models.

To get it working from flutter_tool and not just Xcode, wireless debugging would also be a prerequisite since there is no USB tether option on the TV. Once that's done, it would need to be added a new target device type.

(the wireless part of this comment likely isn't relevant for watches paired to an iPhone, but it would still require tooling work to make it a new recognized target device type)

We would also need to start supporting the tvOS simulator runtime in CI to run tests (sounds easy but nontrivial), since keeping physical TVs upright in the device lab is probably not feasible. Last I checked they required a display hooked up to run XCTests, and the wireless-only devices are practically impossible to keep tethered in a lab setting. No physical devices in CI makes real world performance regression detection also impossible.

(the display hooked up is not relevant for watchOS, but keeping watches paired to iPhones upright in a testing lab is a whole can of worms)

There would also likely need to be some work in the framework/engine to account for differences in the the Apple TV remote, different keyboard, etc. There would also need to be a new tvOS design language like cupertino, but it's unlikely that would live in Flutter framework-proper.

Additionally, the watchOS SDK is more different compared to iOS than the tvOS SDK is, so would also need to implement the WatchKit semantics in the Flutter embedder, WKApplication lifecycle events, etc.

@pedromassango
Copy link
Member

Hello @jmagman thanks for the overview on what needs to be done. My question is is the Flutter team even considering working on this?

Because there are some custom engines that we can currently use to run Flutter on apple Tv, so it seems the that the challenge is not really making it possible but instead how the Flutter team would maintain the support for Apple TV.

One experience I had was, I was able to build/run Flutter on Apple TV, and the only problem that made me discontinue the project was because Plugins (shared_preferences specifically) wasn't work and I didn't have deep knowledge of the Flutter engine to do the necessary changes.

@Rexios80
Copy link
Contributor

@pedromassango
Specifically mentions Apple Watch: https://github.com/flutter/flutter/wiki/Roadmap#non-goals
Relevant: https://github.com/flutter/flutter/wiki/Popular-issues#apple-carplay--android-auto-support-26801

@jmagman
Copy link
Member

jmagman commented Jan 30, 2023

One experience I had was, I was able to build/run Flutter on Apple TV, and the only problem that made me discontinue the project was because Plugins (shared_preferences specifically) wasn't work and I didn't have deep knowledge of the Flutter engine to do the necessary changes.

Plugins are a pain point for custom embedders. For example the eLinux embedder made their own plugins: https://github.com/sony/flutter-elinux-plugins

Example camera plugin:
https://github.com/sony/flutter-elinux-plugins/blob/584bb07788a2ee2472b8331c97d2c717d9149cf2/packages/camera/pubspec.yaml#L20-L21

Tooling code that parses it: https://github.com/sony/flutter-elinux/blob/51a1d685901f79fbac51665a967c3a1a789ecee5/lib/elinux_plugins.dart#L76

There's been a little work supporting sharing more code between macOS and iOS plugins (#115337) so in theory a plugin could support Apple TV and watchOS as well in a shared iOS/macOS directory, but Flutter tooling doesn't support that right now.

@flutter-triage-bot flutter-triage-bot bot added P3 Issues that are less important to the Flutter project and removed P6 labels Jun 28, 2023
@flutter-triage-bot flutter-triage-bot bot added multiteam-retriage-candidate team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team labels Jul 8, 2023
@pranil-iottive

This comment was marked as off-topic.

@jmagman

This comment was marked as off-topic.

@NischalJoshi777

This comment was marked as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer: crowd Affects or could affect many people, though not necessarily a specific customer. engine flutter/engine repository. See also e: labels. P3 Issues that are less important to the Flutter project platform-ios iOS applications specifically team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team
Projects
Mobile - iOS engine review
  
Engineer reviewed
Development

No branches or pull requests