Skip to content

Conversation

@lucasfernog
Copy link

No description provided.

@lucasfernog
Copy link
Author

I did not touch the image functions, but I could take a look at it if needed.

@complexspaces
Copy link
Member

If its reasonable for you, I would prefer to support images on iOS out-of-the-gate as well, since it appears to be supported in the name of preventing cross-platform feature/support drift.

I've seen plenty of apps utilize it so I can see this as being something that bites someone.

let _: usize = unsafe { msg_send![self.pasteboard, clearContents] };
#[cfg(target_os = "ios")]
let _: () = unsafe {
msg_send![self.pasteboard, setItems: NSArray::from_vec(Vec::<Id<NSString>>::new())]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the right array type to clear any existing content type? The docs seem to say this is essentially an array of [String; Any] but its unclear if this matches. At a glance, this needs an inner dictionary type instead of a plain NSString?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type here doesn't really matter, I just want to send an empty array to the items property.
It is indeed technically wrong, so I'll push a fix.

#[cfg(target_os = "ios")]
let success: bool = {
let string = NSString::from_str(&data);
unsafe { msg_send![self.clipboard.pasteboard, setString: string] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this (and other callsites) get mixed up? setString appears to be only a method on NSPasteboard.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setString is the objc way of setting a value for the string property, same as setItems.

@lucasfernog
Copy link
Author

If its reasonable for you, I would prefer to support images on iOS out-of-the-gate as well, since it appears to be supported in the name of preventing cross-platform feature/support drift.

I've seen plenty of apps utilize it so I can see this as being something that bites someone.

@complexspaces I just pushed the iOS image implementation. I had to use PNG instead of TIFF format though.

@rizerco
Copy link

rizerco commented Jan 3, 2024

Is there anything preventing this being merged? I’m sure lots of people would like to see it added. I’m happy to help if I can.

@complexspaces
Copy link
Member

Hi @rizerco, there's still interest in merging this one in but its fallen off my priority list. Previously I was trying to see if there was a way to convert a UIImage into a raw RGBA byte array without needing the image crate.

@lucasfernog-crabnebula
Copy link

anything else i can do?

@complexspaces
Copy link
Member

Thank you for your offer. I am coming up with a plan to resolve conflicts and try testing out the changes here.

I'm interested in getting iOS support landed because it would get 1Password closer to using arboard on all platforms instead of needing a custom Swift implementation. Unfortunately I have a lot of competing priorities, so things can linger for a while despite good intentions on both sides :(

@complexspaces
Copy link
Member

Hi again, I have a short status/transparency update: I believe I've finished rebasing/porting to the latest master as of last week. I still need to test them inside the simulator and on my iOS device but it is moving along.

@lucasfernog
Copy link
Author

Awesome! On the Tauri side we also use a custom Swift implementation 😅

@complexspaces
Copy link
Member

Hey again everyone. I'm sure no one (including me) is happy about how long this one has been sitting but this time I'm back with two bits of forward progress:

  • The objc2 framework crates have had a new release to handle Request for new version release of autogenerated frameworks madsmtm/objc2#656, which unblocked the port/rebase for me.
  • I've documented a plan for iOS's long-term maintenance and support (something that was making me hesitant to merge this originally) in Proposal: Tiers of support and faster progress in the future #191. Once that proposal is implemented, it will be far, far easier for me finish up the iOS work and get it merged since the expectations of "perfect behavior" won't be present anymore.
    • I owe a specific apology to everyone here regarding iOS since my own standards got in the way here and manifested as seeming disinterest in the functionality itself.

Please stay tuned for that work, and please feel free to ping me here over the summer for specific updates on the iOS component.

@complexspaces complexspaces added enhancement New feature or request O-Apple Work related to the macOS or iOS clipboard waiting on review The change is currently waiting on an arboard maintainer for a review or larger-scale update labels Jun 18, 2025
irh added a commit to irh/egui that referenced this pull request Oct 23, 2025
`arboard` doesn't support support iOS yet:
1Password/arboard#103

Launching an app on a physical device results in a long timeout while
trying to connect to the X11 server (the timeout is immediate when
launching on a simulator).
@irh irh mentioned this pull request Oct 23, 2025
1 task
lucasmerlin pushed a commit to emilk/egui that referenced this pull request Oct 23, 2025
`arboard` [doesn't support support iOS
yet](1Password/arboard#103), so this PR adds iOS
to the conditions that prevent `arboard` from being enabled.

Launching an app on a physical device results in a long timeout (~8s)
while trying to connect to the X11 server (the timeout is immediate when
launching on a simulator), with the following trace:

```
egui_winit::clipboard: Failed to initialize arboard clipboard: Unknown error while interacting with the clipboard: X11 server connection timed out because it was unreachable
```

<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

* [x] I have followed the instructions in the PR template
emilk pushed a commit to emilk/egui that referenced this pull request Nov 13, 2025
`arboard` [doesn't support support iOS
yet](1Password/arboard#103), so this PR adds iOS
to the conditions that prevent `arboard` from being enabled.

Launching an app on a physical device results in a long timeout (~8s)
while trying to connect to the X11 server (the timeout is immediate when
launching on a simulator), with the following trace:

```
egui_winit::clipboard: Failed to initialize arboard clipboard: Unknown error while interacting with the clipboard: X11 server connection timed out because it was unreachable
```

<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

* [x] I have followed the instructions in the PR template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request O-Apple Work related to the macOS or iOS clipboard waiting on review The change is currently waiting on an arboard maintainer for a review or larger-scale update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants