NSThread - Is CALayer part of the interface? Is subclass an AS

Hi All

With reference to both posts and AppleScriptObjC Explored(By Shane Stanley), I have two questions regarding threads.

1 - Interface elements are performed on the main thread.
Is a CALayer inserted into a view considered to be part of the interface, or are interface elements strictly buttons, sliders, progress bars etc ?

2 - Only one thread of AppleScript can run at a time.
If I have a custom subclass of AVPlayer,AVAsset etc that is written identically to cocoa, but in AppleScriptObjC, is that considered to be an AppleScript? Are the initiated instances of the subclasses considered to be an AppleScript?

I have been experiencing a few strange performance issues on fading video layers in and out. They don’t happen all the time and the code is solid. I am now at the stage where I need to re-look at my usage of NSThreads.

All feedback very welcome



You can create and manipulate CALayers in background threads, but I’d imagine any adding of layers, drawing and updating might have to be done on the main thread. Certainly when you trigger animations, the actual work happens in a background thread. Really, you will have to look at the documentation and perhaps example projects to get the official word for specific examples.

As for AppleScript: you have a single instance for an application, and it has to run every AppleScript(ObjC) statement, one at a time. The subclasses are actually Objective-C classes, but any ASObjC code you write has to be passed to the single instance of AppleScript to be interpreted.

If you need to get into threading, you need to move beyond ASObjC for some of your code. Indeed, a lot of video and sound stuff eschews Objective-C for straight C to avoid timing issues.