mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
eb5fcafa77
Objective-C interfaces
23 lines
482 B
V
23 lines
482 B
V
module darwin
|
|
|
|
#include <Cocoa/Cocoa.h>
|
|
#flag -framework Cocoa
|
|
|
|
struct C.NSString { }
|
|
|
|
// macOS and iOS helpers
|
|
fn nsstring(s string) *NSString {
|
|
// #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)
|
|
|
|
|
|
}
|
|
|