Documentation Archive Developer
Search

ScriptingBridge Changes for Swift

ScriptingBridge

Removed SBApplication.applicationWithBundleIdentifier(_: String!) -> AnyObject! [class]
Removed SBApplication.applicationWithProcessIdentifier(_: pid_t) -> AnyObject! [class]
Removed SBApplication.applicationWithURL(_: NSURL!) -> AnyObject! [class]
Modified SBApplication
Declaration
From
class SBApplication : SBObject, NSCoding {
    init!(bundleIdentifier ident: String!)
    init!(URL url: NSURL!)
    init!(processIdentifier pid: pid_t)
    class func applicationWithBundleIdentifier(_ ident: String!) -> AnyObject!
    class func applicationWithURL(_ url: NSURL!) -> AnyObject!
    class func applicationWithProcessIdentifier(_ pid: pid_t) -> AnyObject!
    func classForScriptingClass(_ className: String!) -> AnyClass!
    var running: Bool { get }
    func activate()
    var delegate: SBApplicationDelegate!
    var launchFlags: LSLaunchFlags
    var sendMode: AESendMode
    var timeout: Int
}
To
class SBApplication : SBObject {
    init?(bundleIdentifier ident: String)
    init?(URL url: NSURL)
    init?(processIdentifier pid: pid_t)
    class func applicationWithBundleIdentifier(_ ident: String) -> SBApplication?
    class func applicationWithURL(_ url: NSURL) -> SBApplication?
    class func applicationWithProcessIdentifier(_ pid: pid_t) -> SBApplication?
    func classForScriptingClass(_ className: String) -> AnyClass?
    var running: Bool { get }
    func activate()
    var delegate: SBApplicationDelegate?
    var launchFlags: LSLaunchFlags
    var sendMode: AESendMode
    var timeout: Int
}

Declaration
From
func classForScriptingClass(_ className: String!) -> AnyClass!
To
func classForScriptingClass(_ className: String) -> AnyClass?

Declaration
From
var delegate: SBApplicationDelegate!
To
var delegate: SBApplicationDelegate?

Declaration
From
init!(bundleIdentifier ident: String!)
To
init?(bundleIdentifier ident: String)

Declaration
From
init!(processIdentifier pid: pid_t)
To
init?(processIdentifier pid: pid_t)

Declaration
From
init!(URL url: NSURL!)
To
init?(URL url: NSURL)

Declaration
From
protocol SBApplicationDelegate {
    func eventDidFail(_ event: UnsafePointer<AppleEvent>, withError error: NSError!) -> AnyObject!
}
To
protocol SBApplicationDelegate {
    func eventDidFail(_ event: UnsafePointer<AppleEvent>, withError error: NSError) -> AnyObject
}

Declaration
From
func eventDidFail(_ event: UnsafePointer<AppleEvent>, withError error: NSError!) -> AnyObject!
To
func eventDidFail(_ event: UnsafePointer<AppleEvent>, withError error: NSError) -> AnyObject

Declaration
From
class SBElementArray : NSMutableArray {
    func objectWithName(_ name: String!) -> AnyObject!
    func objectWithID(_ identifier: AnyObject!) -> AnyObject!
    func objectAtLocation(_ location: AnyObject!) -> AnyObject!
    func arrayByApplyingSelector(_ selector: Selector) -> [AnyObject]!
    func arrayByApplyingSelector(_ aSelector: Selector, withObject argument: AnyObject!) -> [AnyObject]!
    func get() -> [AnyObject]!
}
To
class SBElementArray : NSMutableArray {
    func objectWithName(_ name: String) -> AnyObject
    func objectWithID(_ identifier: AnyObject) -> AnyObject
    func objectAtLocation(_ location: AnyObject) -> AnyObject
    func arrayByApplyingSelector(_ selector: Selector) -> [AnyObject]
    func arrayByApplyingSelector(_ aSelector: Selector, withObject argument: AnyObject) -> [AnyObject]
    func get() -> [AnyObject]?
}

Declaration
From
func arrayByApplyingSelector(_ selector: Selector) -> [AnyObject]!
To
func arrayByApplyingSelector(_ selector: Selector) -> [AnyObject]

Declaration
From
func arrayByApplyingSelector(_ aSelector: Selector, withObject argument: AnyObject!) -> [AnyObject]!
To
func arrayByApplyingSelector(_ aSelector: Selector, withObject argument: AnyObject) -> [AnyObject]

Declaration
From
func get() -> [AnyObject]!
To
func get() -> [AnyObject]?

Declaration
From
func objectAtLocation(_ location: AnyObject!) -> AnyObject!
To
func objectAtLocation(_ location: AnyObject) -> AnyObject

Declaration
From
func objectWithID(_ identifier: AnyObject!) -> AnyObject!
To
func objectWithID(_ identifier: AnyObject) -> AnyObject

Declaration
From
func objectWithName(_ name: String!) -> AnyObject!
To
func objectWithName(_ name: String) -> AnyObject

Modified SBObject
Declaration
From
class SBObject : NSObject, NSCoding {
    init!()
    init!(properties properties: [NSObject : AnyObject]!)
    init!(data data: AnyObject!)
    func get() -> AnyObject!
    func lastError() -> NSError!
}
extension SBObject {
    init!(elementCode code: DescType, properties properties: [NSObject : AnyObject]!, data data: AnyObject!)
    func propertyWithCode(_ code: AEKeyword) -> SBObject!
    func propertyWithClass(_ cls: AnyClass!, code code: AEKeyword) -> SBObject!
    func elementArrayWithCode(_ code: DescType) -> SBElementArray!
    func setTo(_ value: AnyObject!)
}
To
class SBObject : NSObject, NSCoding {
    init()
    init(properties properties: [NSObject : AnyObject])
    init(data data: AnyObject)
    func get() -> AnyObject?
    func lastError() -> NSError?
}
extension SBObject {
    init(elementCode code: DescType, properties properties: [String : AnyObject]?, data data: AnyObject?)
    func propertyWithCode(_ code: AEKeyword) -> SBObject
    func propertyWithClass(_ cls: AnyClass, code code: AEKeyword) -> SBObject
    func elementArrayWithCode(_ code: DescType) -> SBElementArray
    func setTo(_ value: AnyObject?)
}

Declaration
From
func elementArrayWithCode(_ code: DescType) -> SBElementArray!
To
func elementArrayWithCode(_ code: DescType) -> SBElementArray

Declaration
From
func get() -> AnyObject!
To
func get() -> AnyObject?

Declaration
From
init!()
To
init()

Declaration
From
init!(data data: AnyObject!)
To
init(data data: AnyObject)

Declaration
From
init!(elementCode code: DescType, properties properties: [NSObject : AnyObject]!, data data: AnyObject!)
To
init(elementCode code: DescType, properties properties: [String : AnyObject]?, data data: AnyObject?)

Declaration
From
init!(properties properties: [NSObject : AnyObject]!)
To
init(properties properties: [NSObject : AnyObject])

Declaration
From
func lastError() -> NSError!
To
func lastError() -> NSError?

Declaration
From
func propertyWithClass(_ cls: AnyClass!, code code: AEKeyword) -> SBObject!
To
func propertyWithClass(_ cls: AnyClass, code code: AEKeyword) -> SBObject

Declaration
From
func propertyWithCode(_ code: AEKeyword) -> SBObject!
To
func propertyWithCode(_ code: AEKeyword) -> SBObject

Declaration
From
func setTo(_ value: AnyObject!)
To
func setTo(_ value: AnyObject?)