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

Fix (iOS): Clipboard get/set missing implement #52540

Merged
merged 1 commit into from
Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions platform/iphone/os_iphone.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ class OSIPhone : public OS_Unix {
virtual String get_name() const;
virtual String get_model_name() const;

virtual void set_clipboard(const String &p_text);
virtual String get_clipboard() const;

Error shell_open(String p_uri);

String get_user_data_dir() const;
Expand Down
10 changes: 10 additions & 0 deletions platform/iphone/os_iphone.mm
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,16 @@ void register_dynamic_symbol(char *name, void *address) {
return "iOS";
}

void OSIPhone::set_clipboard(const String &p_text) {
[UIPasteboard generalPasteboard].string = [NSString stringWithUTF8String:p_text.utf8()];
}

String OSIPhone::get_clipboard() const {
NSString *text = [UIPasteboard generalPasteboard].string;

return String::utf8([text UTF8String]);
}

String OSIPhone::get_model_name() const {
String model = ios->get_model();
if (model != "") {
Expand Down