geode/loader/src/platform/ios/util.mm

32 lines
740 B
Text
Raw Normal View History

2022-07-30 12:24:03 -04:00
#include <Geode/DefaultInclude.hpp>
2022-07-30 12:24:03 -04:00
#ifdef GEODE_IS_IOS
USE_GEODE_NAMESPACE();
2022-10-30 14:56:36 -04:00
#include <UIKit/UIKit.h>
#include <iostream>
#include <sstream>
2022-11-28 12:27:56 -05:00
#include <Geode/utils/web.hpp>
2022-07-30 12:24:03 -04:00
bool utils::clipboard::write(std::string const& data) {
2022-10-30 14:56:36 -04:00
[UIPasteboard generalPasteboard].string = [NSString stringWithUTF8String:data.c_str()];
2022-07-30 12:24:03 -04:00
return true;
}
std::string utils::clipboard::read() {
2022-10-30 14:56:36 -04:00
return std::string([[UIPasteboard generalPasteboard].string UTF8String]);
2022-07-30 12:24:03 -04:00
}
void utils::web::openLinkInBrowser(std::string const& url) {
2022-10-30 14:56:36 -04:00
[[UIApplication sharedApplication]
openURL:[NSURL URLWithString:[NSString stringWithUTF8String:url.c_str()]]];
2022-07-30 12:24:03 -04:00
}
void geode_nslog(uintptr_t x) {
2022-10-30 14:56:36 -04:00
NSLog(@"geode %lx", x);
2022-07-30 12:24:03 -04:00
}
#endif