2019-08-20 13:34:29 +02:00
|
|
|
module darwin
|
|
|
|
|
|
|
|
#include <Cocoa/Cocoa.h>
|
|
|
|
#flag -framework Cocoa
|
|
|
|
|
|
|
|
struct C.NSString { }
|
|
|
|
|
|
|
|
// macOS and iOS helpers
|
2019-09-21 20:38:12 +02:00
|
|
|
pub fn nsstring(s string) *NSString {
|
2019-08-20 13:34:29 +02:00
|
|
|
// #return @"" ;
|
|
|
|
// println('ns $s len=$s.len')
|
|
|
|
# return [ [ NSString alloc ] initWithBytesNoCopy:s.str length:s.len
|
|
|
|
# encoding:NSUTF8StringEncoding freeWhenDone: false];
|
|
|
|
return 0
|
|
|
|
|
|
|
|
//ns := C.alloc_NSString()
|
|
|
|
//return ns.initWithBytesNoCopy(s.str, length: s.len,
|
|
|
|
//encoding: NSUTF8StringEncoding, freeWhenDone: false)
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|