Skip to content

Add iOS support #103

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add iOS support #103

wants to merge 3 commits into from

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
Collaborator

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
Collaborator

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
Collaborator

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
Collaborator

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
Collaborator

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
Collaborator

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
Collaborator

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
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