Is there an elegant way to get contents of a NSString instance referenced by a ptr variable into a Xojo TEXT variable?
[code]declare function stringWithString lib “Foundation” selector “stringWithString:” (clsRef as ptr, str as ptr) as cfstringref
declare function NSClassFromString lib “Foundation” (clsName as cfstringref) as ptr
dim TheText as text = stringWithString(NSClassFromString(“NSString”),NSSTRINGPTR)[/code]
Where NSSTRINGPTR is a pointer to the NSString instance.
You can actually just do this:
Function NSStringToText(str As Ptr) As Text
Declare Function self_ Lib "Foundation" Selector "self" (str As Ptr) As CFStringRef
Even better! Didn’t realize that was possible.