PyObjC Framework SecurityUI

12.1 · active · verified Tue Apr 14

PyObjC Framework SecurityUI provides Python bindings for Apple's SecurityUI.framework on macOS. This framework offers user interface components for interacting with security-related authorization services. Version 12.1 is the current release, part of the larger PyObjC project, which generally follows macOS and Python release cycles.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to verify the presence of the SecurityUI framework and successfully import a key class (`SFAuthorization`). It confirms the Python bindings are correctly installed and accessible on a macOS system without requiring a full GUI application.

from Foundation import NSBundle
from SecurityUI import SFAuthorization

# This example verifies the SecurityUI framework and a key class are available.

# Check if the framework bundle exists
security_ui_bundle = NSBundle.bundleWithPath_(
    '/System/Library/Frameworks/SecurityUI.framework'
)
if security_ui_bundle:
    print(f"SecurityUI framework bundle found at {security_ui_bundle.bundlePath()}")
    print(f"Framework version: {security_ui_bundle.bundleShortVersionString()}")
else:
    print("SecurityUI framework bundle not found or inaccessible. "
          "Ensure you are running on macOS.")

# Verify a key class from the framework can be imported and accessed
try:
    auth_class = SFAuthorization
    print(f"Successfully imported SFAuthorization class: {auth_class}")
    # In a real application, you'd then instantiate and use auth_class
    # e.g., auth = auth_class.alloc().init()
except NameError:
    print("Failed to import SFAuthorization class from SecurityUI. "
          "Ensure pyobjc-framework-securityui is installed and running on macOS.")

view raw JSON →