Renamed NSString to NSStringRust to support Debug View Heirarchy in Xcode (#1631)

* Renamed NSString to NSStringRust to support Debug View Heirarchy

* Updated from comments

* Update CHANGELOG.md
This commit is contained in:
simlay 2020-08-14 12:26:16 -07:00 committed by GitHub
parent 514ab043f2
commit 412bd94ea4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View file

@ -359,7 +359,10 @@ pub struct CFRunLoopSourceContext {
pub perform: Option<extern "C" fn(*mut c_void)>,
}
pub trait NSString: Sized {
// This is named NSStringRust rather than NSString because the "Debug View Heirarchy" feature of
// Xcode requires a non-ambiguous reference to NSString for unclear reasons. This makes Xcode happy
// so please test if you change the name back to NSString.
pub trait NSStringRust: Sized {
unsafe fn alloc(_: Self) -> id {
msg_send![class!(NSString), alloc]
}
@ -370,7 +373,7 @@ pub trait NSString: Sized {
unsafe fn UTF8String(self) -> *const c_char;
}
impl NSString for id {
impl NSStringRust for id {
unsafe fn initWithUTF8String_(self, c_string: *const c_char) -> id {
msg_send![self, initWithUTF8String: c_string as id]
}