PyObjC IntentsUI Framework

12.1 · active · verified Tue Apr 14

pyobjc-framework-intentsui provides Python wrappers for Apple's IntentsUI framework on macOS. It is part of the PyObjC project, a bidirectional bridge enabling Python scripts to interact with Objective-C libraries, including macOS Cocoa frameworks. The current version is 12.1 and it maintains an active release cadence, typically aligning with macOS SDK updates and Python version support.

Warnings

Install

Imports

Quickstart

The IntentsUI framework classes, such as `INUIAddVoiceShortcutViewController`, are designed for building UI within SiriKit Intents UI extensions. A direct, standalone Python quickstart without a full macOS application and Xcode project setup is not practical for demonstrating functional UI. This snippet shows a basic import and explains the typical context of usage.

from IntentsUI import INUIAddVoiceShortcutViewController
from Foundation import NSObject

# IntentsUI classes like INUIAddVoiceShortcutViewController are typically used within
# a macOS application's Intents UI Extension, often involving XCode and Interface Builder.
# A simple standalone Python script usually cannot directly instantiate and display 
# these UI elements without a full application context.

# This example primarily shows the import and a placeholder for where you might use it.
# For actual usage, refer to Apple's SiriKit documentation and PyObjC examples
# involving py2app and application development.

def create_intents_ui_controller():
    # In a real application, you would instantiate and configure this controller.
    # For example, to add a voice shortcut:
    # controller = INUIAddVoiceShortcutViewController.alloc().initWithShortcut_(your_shortcut)
    # Or, using the Pythonic instantiation (PyObjC 10.4+):
    # controller = INUIAddVoiceShortcutViewController(shortcut=your_shortcut)
    print(f"Successfully imported {INUIAddVoiceShortcutViewController.__name__}.")
    print("IntentsUI classes require an application context, typically an Intents UI Extension.")
    return None

if __name__ == "__main__":
    create_intents_ui_controller()

view raw JSON →