or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

android-platform.mdindex.mdios-platform.mdnative-interop.mdnativescript-widgets.md

ios-platform.mddocs/

0

# iOS Platform

1

2

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.

3

4

## Capabilities

5

6

### iOS Entry Point

7

8

Single entry point providing access to all iOS SDK frameworks and runtime functions.

9

10

```typescript { .api }

11

/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />

12

```

13

14

### Core iOS Runtime Functions

15

16

Essential runtime functions for iOS development and native object management.

17

18

```typescript { .api }

19

/**

20

* Trigger garbage collection in JavaScript

21

*/

22

declare function __collect(): void;

23

24

/**

25

* Release the reference to the wrapped native Objective-C object

26

* @param object - The Objective-C object to release

27

*/

28

declare function __releaseNativeCounterpart(object: NSObject): void;

29

30

/**

31

* Get accurate system timestamp in milliseconds

32

* @returns Current system time in milliseconds

33

*/

34

declare function __time(): Number;

35

```

36

37

**Usage Examples:**

38

39

```typescript

40

// Create and manage NSObject instances

41

const nsString = new NSString("Hello iOS");

42

// ... use the object

43

__releaseNativeCounterpart(nsString); // Release when done

44

45

// Get high-precision timestamp

46

const timestamp = __time();

47

console.log(`Current time: ${timestamp}`);

48

49

// Trigger garbage collection

50

__collect();

51

```

52

53

### iOS Framework Declarations

54

55

Comprehensive type definitions for all iOS SDK frameworks. Each framework is provided as a separate declaration file.

56

57

```typescript { .api }

58

// Core frameworks (sample - 139 total frameworks available)

59

/// <reference path="objc-x86_64/objc!Foundation.d.ts" />

60

/// <reference path="objc-x86_64/objc!UIKit.d.ts" />

61

/// <reference path="objc-x86_64/objc!CoreFoundation.d.ts" />

62

/// <reference path="objc-x86_64/objc!CoreGraphics.d.ts" />

63

/// <reference path="objc-x86_64/objc!AVFoundation.d.ts" />

64

/// <reference path="objc-x86_64/objc!CoreData.d.ts" />

65

/// <reference path="objc-x86_64/objc!CoreLocation.d.ts" />

66

/// <reference path="objc-x86_64/objc!CoreMotion.d.ts" />

67

/// <reference path="objc-x86_64/objc!MapKit.d.ts" />

68

/// <reference path="objc-x86_64/objc!StoreKit.d.ts" />

69

70

// Media and graphics frameworks

71

/// <reference path="objc-x86_64/objc!ARKit.d.ts" />

72

/// <reference path="objc-x86_64/objc!AVKit.d.ts" />

73

/// <reference path="objc-x86_64/objc!CoreImage.d.ts" />

74

/// <reference path="objc-x86_64/objc!CoreMedia.d.ts" />

75

/// <reference path="objc-x86_64/objc!CoreVideo.d.ts" />

76

/// <reference path="objc-x86_64/objc!GameplayKit.d.ts" />

77

/// <reference path="objc-x86_64/objc!Metal.d.ts" />

78

/// <reference path="objc-x86_64/objc!SpriteKit.d.ts" />

79

80

// System and utility frameworks

81

/// <reference path="objc-x86_64/objc!Accelerate.d.ts" />

82

/// <reference path="objc-x86_64/objc!CloudKit.d.ts" />

83

/// <reference path="objc-x86_64/objc!CoreML.d.ts" />

84

/// <reference path="objc-x86_64/objc!CryptoTokenKit.d.ts" />

85

/// <reference path="objc-x86_64/objc!EventKit.d.ts" />

86

/// <reference path="objc-x86_64/objc!HealthKit.d.ts" />

87

/// <reference path="objc-x86_64/objc!HomeKit.d.ts" />

88

/// <reference path="objc-x86_64/objc!LocalAuthentication.d.ts" />

89

/// <reference path="objc-x86_64/objc!MultipeerConnectivity.d.ts" />

90

/// <reference path="objc-x86_64/objc!NetworkExtension.d.ts" />

91

/// <reference path="objc-x86_64/objc!NotificationCenter.d.ts" />

92

/// <reference path="objc-x86_64/objc!PassKit.d.ts" />

93

/// <reference path="objc-x86_64/objc!PushKit.d.ts" />

94

/// <reference path="objc-x86_64/objc!QuickLook.d.ts" />

95

/// <reference path="objc-x86_64/objc!SafariServices.d.ts" />

96

/// <reference path="objc-x86_64/objc!Security.d.ts" />

97

/// <reference path="objc-x86_64/objc!Social.d.ts" />

98

/// <reference path="objc-x86_64/objc!WatchConnectivity.d.ts" />

99

/// <reference path="objc-x86_64/objc!WebKit.d.ts" />

100

101

// And 110+ additional iOS frameworks...

102

```

103

104

**Usage Examples:**

105

106

```typescript

107

// All frameworks are available automatically when using ios.d.ts

108

/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />

109

110

// Use Foundation framework

111

const nsString = NSString.stringWithString("Hello World");

112

const nsArray = NSMutableArray.alloc().init();

113

114

// Use UIKit framework

115

const alertController = UIAlertController.alertControllerWithTitleMessagePreferredStyle(

116

"Alert",

117

"This is an alert",

118

UIAlertControllerStyle.Alert

119

);

120

121

// Use Core Location

122

const locationManager = CLLocationManager.alloc().init();

123

locationManager.requestWhenInUseAuthorization();

124

125

// Use AVFoundation

126

const audioSession = AVAudioSession.sharedInstance();

127

```

128

129

### Complete Framework Coverage

130

131

TNS Platform Declarations includes type definitions for all major iOS frameworks:

132

133

**Core System Frameworks:**

134

- Foundation - Core classes and data types

135

- UIKit - User interface components

136

- CoreFoundation - Low-level C APIs

137

- CoreGraphics - 2D graphics and imaging

138

- CoreData - Data persistence framework

139

- CoreServices - Essential system services

140

141

**Media and Graphics:**

142

- AVFoundation - Audio and video media framework

143

- AVKit - Media playback user interface

144

- CoreImage - Image processing and analysis

145

- CoreMedia - Low-level media types and functions

146

- CoreVideo - Video processing pipeline

147

- Metal - GPU-accelerated graphics and compute

148

- ARKit - Augmented reality framework

149

- SpriteKit - 2D game development

150

151

**Networking and Communication:**

152

- CFNetwork - Network services and protocols

153

- NetworkExtension - Network extension apps

154

- MultipeerConnectivity - Peer-to-peer connectivity

155

- WatchConnectivity - Apple Watch communication

156

157

**Device and Sensors:**

158

- CoreLocation - Location and heading services

159

- CoreMotion - Motion and environment sensing

160

- CoreBluetooth - Bluetooth Low Energy communication

161

- HealthKit - Health and fitness data

162

- HomeKit - Home automation framework

163

164

**Business and Productivity:**

165

- EventKit - Calendar and reminder data

166

- Contacts - Contact information access

167

- AddressBook - Legacy contact framework

168

- PassKit - Apple Pay and wallet functionality

169

- StoreKit - In-app purchases and subscriptions

170

171

**Security and Authentication:**

172

- Security - Cryptographic services

173

- LocalAuthentication - Biometric authentication

174

- CryptoTokenKit - Cryptographic token interface

175

- KeychainServices - Secure credential storage

176

177

**Development and Debugging:**

178

- os - Unified logging system

179

- Darwin - Low-level Darwin interfaces

180

- Dispatch - Grand Central Dispatch

181

182

### Complete iOS Framework Catalog

183

184

TNS Platform Declarations includes 139 iOS framework declaration files. Here's the complete catalog organized by category:

185

186

**Core System Frameworks (18 frameworks):**

187

- Foundation, UIKit, CoreFoundation, CoreGraphics, CoreServices, CoreData

188

- CFNetwork, Dispatch, Darwin, QuartzCore, os, ObjectiveC

189

- CoreText, ImageIO, MobileCoreServices, SystemConfiguration, UniformTypeIdentifiers, OSLog

190

191

**Media and Graphics (24 frameworks):**

192

- AVFoundation, AVKit, CoreImage, CoreMedia, CoreVideo, CoreAudio, AudioToolbox

193

- VideoToolbox, CoreAnimation, Metal, MetalKit, MetalPerformanceShaders

194

- ARKit, RealityKit, SpriteKit, SceneKit, GameplayKit, ReplayKit

195

- Photos, PhotosUI, AssetsLibrary, MediaPlayer, MediaToolbox, CoreML, Vision

196

197

**Networking and Communication (12 frameworks):**

198

- CFNetwork, NetworkExtension, Network, MultipeerConnectivity, WatchConnectivity

199

- CallKit, PushKit, UserNotifications, BackgroundTasks, Combine, WebKit, SafariServices

200

201

**Device and Sensors (18 frameworks):**

202

- CoreLocation, CoreMotion, CoreBluetooth, HealthKit, HomeKit, CoreTelephony

203

- ExternalAccessory, GameController, CoreHaptics, DeviceCheck, SensorKit

204

- ProximityReader, AccessibilityUIKit, VisionKit, NaturalLanguage, Speech, SoundAnalysis, Intents

205

206

**Business and Productivity (15 frameworks):**

207

- EventKit, EventKitUI, Contacts, ContactsUI, AddressBook, AddressBookUI

208

- PassKit, StoreKit, MessageUI, MailKit, QuickLook, FileProvider

209

- DocumentCloud, UniformTypeIdentifiers, LinkPresentation

210

211

**Security and Authentication (8 frameworks):**

212

- Security, LocalAuthentication, CryptoTokenKit, AuthenticationServices

213

- CryptoKit, KeychainServices, AppTrackingTransparency, AdSupport

214

215

**User Interface and Experience (22 frameworks):**

216

- UIKit, SwiftUI, AppKit, WatchKit, TVUIKit, CarPlay, WidgetKit

217

- NotificationCenter, UserNotifications, UserNotificationsUI, PencilKit

218

- PDFKit, QuickLookThumbnailing, MessageUI, Social, CloudKit

219

- CoreSpotlight, Intents, IntentsUI, ActivityKit, ScreenTime, FamilyControls

220

221

**Machine Learning and AI (8 frameworks):**

222

- CoreML, Vision, NaturalLanguage, Speech, SoundAnalysis, CreateML, TabularData, RealityFoundation

223

224

**Development and Debugging (14 frameworks):**

225

- XCTest, OSLog, MetricKit, Instruments, DeveloperToolsSupport

226

- SwiftDocC, SwiftDocCPlugin, PackageDescription, ArgumentParser

227

- Collections, Algorithms, AsyncAlgorithms, RegexBuilder, _Concurrency

228

229

## Memory Management

230

231

iOS platform declarations support both manual and automatic memory management:

232

233

```typescript

234

// Manual memory management

235

const nsObject = NSObject.alloc().init();

236

try {

237

// Use the object...

238

} finally {

239

__releaseNativeCounterpart(nsObject);

240

}

241

242

// Automatic memory management (recommended)

243

const autoString = NSString.stringWithString("Auto-managed");

244

// No manual release needed

245

246

// Garbage collection

247

__collect();

248

```

249

250

## Framework Usage Patterns

251

252

### Foundation Framework Usage

253

254

```typescript

255

// String operations

256

const str = NSString.stringWithString("Hello");

257

const uppercaseStr = str.uppercaseString;

258

259

// Array operations

260

const array = NSMutableArray.alloc().init();

261

array.addObject("Item 1");

262

array.addObject("Item 2");

263

264

// Dictionary operations

265

const dict = NSMutableDictionary.alloc().init();

266

dict.setObjectForKey("value", "key");

267

```

268

269

### UIKit Framework Usage

270

271

```typescript

272

// View controller

273

const viewController = UIViewController.alloc().init();

274

viewController.title = "My View";

275

276

// Alert controller

277

const alert = UIAlertController.alertControllerWithTitleMessagePreferredStyle(

278

"Title",

279

"Message",

280

UIAlertControllerStyle.Alert

281

);

282

283

// Add alert action

284

const action = UIAlertAction.actionWithTitleStyleHandler(

285

"OK",

286

UIAlertActionStyle.Default,

287

null

288

);

289

alert.addAction(action);

290

```

291

292

## Performance Considerations

293

294

- **Framework Loading**: Only frameworks referenced in code are loaded

295

- **Memory Usage**: iOS declarations are comprehensive and memory-intensive

296

- **Compilation Time**: Large number of frameworks can slow TypeScript compilation

297

- **Runtime Performance**: Native calls have minimal overhead through NativeScript runtime