diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h index 633864b11f5..35108acdb67 100644 --- a/platform/iphone/os_iphone.h +++ b/platform/iphone/os_iphone.h @@ -110,6 +110,9 @@ public: 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; diff --git a/platform/iphone/os_iphone.mm b/platform/iphone/os_iphone.mm index a8cb6f061d6..17c28db8ca6 100644 --- a/platform/iphone/os_iphone.mm +++ b/platform/iphone/os_iphone.mm @@ -466,6 +466,16 @@ String OSIPhone::get_name() const { 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 != "") {