Platform-specific TypeScript declarations for NativeScript for accessing native objects
84
Complete iOS SDK framework declarations providing access to all iOS frameworks, native memory management utilities, and Objective-C runtime integration. Covers 139 iOS frameworks from ARKit to WebKit.
Single entry point providing access to all iOS SDK frameworks and runtime functions.
/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />Essential runtime functions for iOS development and native object management.
/**
* Trigger garbage collection in JavaScript
*/
declare function __collect(): void;
/**
* Release the reference to the wrapped native Objective-C object
* @param object - The Objective-C object to release
*/
declare function __releaseNativeCounterpart(object: NSObject): void;
/**
* Get accurate system timestamp in milliseconds
* @returns Current system time in milliseconds
*/
declare function __time(): Number;Usage Examples:
// Create and manage NSObject instances
const nsString = new NSString("Hello iOS");
// ... use the object
__releaseNativeCounterpart(nsString); // Release when done
// Get high-precision timestamp
const timestamp = __time();
console.log(`Current time: ${timestamp}`);
// Trigger garbage collection
__collect();Comprehensive type definitions for all iOS SDK frameworks. Each framework is provided as a separate declaration file.
// Core frameworks (sample - 139 total frameworks available)
/// <reference path="objc-x86_64/objc!Foundation.d.ts" />
/// <reference path="objc-x86_64/objc!UIKit.d.ts" />
/// <reference path="objc-x86_64/objc!CoreFoundation.d.ts" />
/// <reference path="objc-x86_64/objc!CoreGraphics.d.ts" />
/// <reference path="objc-x86_64/objc!AVFoundation.d.ts" />
/// <reference path="objc-x86_64/objc!CoreData.d.ts" />
/// <reference path="objc-x86_64/objc!CoreLocation.d.ts" />
/// <reference path="objc-x86_64/objc!CoreMotion.d.ts" />
/// <reference path="objc-x86_64/objc!MapKit.d.ts" />
/// <reference path="objc-x86_64/objc!StoreKit.d.ts" />
// Media and graphics frameworks
/// <reference path="objc-x86_64/objc!ARKit.d.ts" />
/// <reference path="objc-x86_64/objc!AVKit.d.ts" />
/// <reference path="objc-x86_64/objc!CoreImage.d.ts" />
/// <reference path="objc-x86_64/objc!CoreMedia.d.ts" />
/// <reference path="objc-x86_64/objc!CoreVideo.d.ts" />
/// <reference path="objc-x86_64/objc!GameplayKit.d.ts" />
/// <reference path="objc-x86_64/objc!Metal.d.ts" />
/// <reference path="objc-x86_64/objc!SpriteKit.d.ts" />
// System and utility frameworks
/// <reference path="objc-x86_64/objc!Accelerate.d.ts" />
/// <reference path="objc-x86_64/objc!CloudKit.d.ts" />
/// <reference path="objc-x86_64/objc!CoreML.d.ts" />
/// <reference path="objc-x86_64/objc!CryptoTokenKit.d.ts" />
/// <reference path="objc-x86_64/objc!EventKit.d.ts" />
/// <reference path="objc-x86_64/objc!HealthKit.d.ts" />
/// <reference path="objc-x86_64/objc!HomeKit.d.ts" />
/// <reference path="objc-x86_64/objc!LocalAuthentication.d.ts" />
/// <reference path="objc-x86_64/objc!MultipeerConnectivity.d.ts" />
/// <reference path="objc-x86_64/objc!NetworkExtension.d.ts" />
/// <reference path="objc-x86_64/objc!NotificationCenter.d.ts" />
/// <reference path="objc-x86_64/objc!PassKit.d.ts" />
/// <reference path="objc-x86_64/objc!PushKit.d.ts" />
/// <reference path="objc-x86_64/objc!QuickLook.d.ts" />
/// <reference path="objc-x86_64/objc!SafariServices.d.ts" />
/// <reference path="objc-x86_64/objc!Security.d.ts" />
/// <reference path="objc-x86_64/objc!Social.d.ts" />
/// <reference path="objc-x86_64/objc!WatchConnectivity.d.ts" />
/// <reference path="objc-x86_64/objc!WebKit.d.ts" />
// And 110+ additional iOS frameworks...Usage Examples:
// All frameworks are available automatically when using ios.d.ts
/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
// Use Foundation framework
const nsString = NSString.stringWithString("Hello World");
const nsArray = NSMutableArray.alloc().init();
// Use UIKit framework
const alertController = UIAlertController.alertControllerWithTitleMessagePreferredStyle(
"Alert",
"This is an alert",
UIAlertControllerStyle.Alert
);
// Use Core Location
const locationManager = CLLocationManager.alloc().init();
locationManager.requestWhenInUseAuthorization();
// Use AVFoundation
const audioSession = AVAudioSession.sharedInstance();TNS Platform Declarations includes type definitions for all major iOS frameworks:
Core System Frameworks:
Media and Graphics:
Networking and Communication:
Device and Sensors:
Business and Productivity:
Security and Authentication:
Development and Debugging:
TNS Platform Declarations includes 139 iOS framework declaration files. Here's the complete catalog organized by category:
Core System Frameworks (18 frameworks):
Media and Graphics (24 frameworks):
Networking and Communication (12 frameworks):
Device and Sensors (18 frameworks):
Business and Productivity (15 frameworks):
Security and Authentication (8 frameworks):
User Interface and Experience (22 frameworks):
Machine Learning and AI (8 frameworks):
Development and Debugging (14 frameworks):
iOS platform declarations support both manual and automatic memory management:
// Manual memory management
const nsObject = NSObject.alloc().init();
try {
// Use the object...
} finally {
__releaseNativeCounterpart(nsObject);
}
// Automatic memory management (recommended)
const autoString = NSString.stringWithString("Auto-managed");
// No manual release needed
// Garbage collection
__collect();// String operations
const str = NSString.stringWithString("Hello");
const uppercaseStr = str.uppercaseString;
// Array operations
const array = NSMutableArray.alloc().init();
array.addObject("Item 1");
array.addObject("Item 2");
// Dictionary operations
const dict = NSMutableDictionary.alloc().init();
dict.setObjectForKey("value", "key");// View controller
const viewController = UIViewController.alloc().init();
viewController.title = "My View";
// Alert controller
const alert = UIAlertController.alertControllerWithTitleMessagePreferredStyle(
"Title",
"Message",
UIAlertControllerStyle.Alert
);
// Add alert action
const action = UIAlertAction.actionWithTitleStyleHandler(
"OK",
UIAlertActionStyle.Default,
null
);
alert.addAction(action);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