---
title: SBApplication
framework: Scripting Bridge
role: symbol
role_heading: Class
platforms: [Mac Catalyst 13.0+, macOS 10.5+]
path: scriptingbridge/sbapplication
---

# SBApplication

The SBApplication class provides a mechanism enabling an Objective-C program to send Apple events to a scriptable application and receive Apple events in response. It thereby makes it possible for that program to control the application and exchange data with it. Scripting Bridge works by bridging data types between Apple event descriptors and Cocoa objects.

## Declaration

```swift
class SBApplication
```

## Overview

Overview Although SBApplication includes methods that manually send and process Apple events, you should never have to call these methods directly. Instead, subclasses of SBApplication implement application-specific methods that handle the sending of Apple events automatically. For example, if you wanted to get the current iTunes track, you can simply use the currentTrack method of the dynamically defined subclass for the iTunes application—which handles the details of sending the Apple event for you—rather than figuring out the more complicated, low-level alternative: [iTunes propertyWithCode:'pTrk']; If you do need to send Apple events manually, consider using the NSAppleEventDescriptor class. Subclassing Notes You rarely instantiate SBApplication objects directly. Instead, you get the shared instance of a application-specific subclass typically by calling one of the applicationWith... class methods, using a bundle identifier, process identifier, or URL to identify the application.

## Topics

### Initializing a Scriptable Application Object

- [init(bundleIdentifier:)](scriptingbridge/sbapplication/init(bundleidentifier:).md)
- [init(processIdentifier:)](scriptingbridge/sbapplication/init(processidentifier:).md)
- [init(url:)](scriptingbridge/sbapplication/init(url:)-6xbe5.md)

### Creating a Scripting Class

- [class(forScriptingClass:)](scriptingbridge/sbapplication/class(forscriptingclass:).md)

### Controlling the Application

- [activate()](scriptingbridge/sbapplication/activate().md)
- [isRunning](scriptingbridge/sbapplication/isrunning.md)
- [launchFlags](scriptingbridge/sbapplication/launchflags.md)
- [sendMode](scriptingbridge/sbapplication/sendmode.md)
- [timeout](scriptingbridge/sbapplication/timeout.md)

### Managing the Delegate

- [delegate](scriptingbridge/sbapplication/delegate.md)

### Initializers

- [init(URL:)](scriptingbridge/sbapplication/init(url:)-2kr06.md)
- [init(URL:)](scriptingbridge/sbapplication/init(url:)-4bno1.md)

## Relationships

### Inherits From

- [SBObject](scriptingbridge/sbobject.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
