Platform-specific TypeScript declarations for NativeScript for accessing native objects
84
A utility module for NativeScript iOS applications that safely manages Core Foundation string objects returned from native APIs. The module must properly handle Core Foundation memory management semantics, particularly for strings that come with different ownership conventions.
When a Core Foundation API returns a string with a +1 retain count (meaning ownership is transferred), the system must properly consume that ownership and convert it to a JavaScript string without leaking memory.
When a Core Foundation API returns a string with +0 retain count (meaning the reference is borrowed), the system must access the value without affecting the retain count.
@generates
The implementation should use the appropriate NativeScript iOS interop mechanisms to handle unmanaged Core Foundation references. Consider the ownership semantics carefully to prevent memory leaks or premature releases.
/**
* Converts a Core Foundation string that was returned with +1 retain count
* (ownership transferred) to a JavaScript string. This function consumes
* the ownership.
*
* @param cfStringRef - An unmanaged reference to a CFString with +1 retain
* @returns The JavaScript string value
*/
export function convertRetainedString(cfStringRef: any): string;
/**
* Converts a Core Foundation string that was returned with +0 retain count
* (borrowed reference) to a JavaScript string. This function does not
* affect the retain count.
*
* @param cfStringRef - An unmanaged reference to a CFString with +0 retain
* @returns The JavaScript string value
*/
export function convertUnretainedString(cfStringRef: any): string;Provides iOS platform type definitions and interop utilities for NativeScript applications.
Install with Tessl CLI
npx tessl i tessl/npm-tns-platform-declarationsevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10