PyObjC GameSave Framework

12.1 · active · verified Wed Apr 15

pyobjc-framework-gamesave provides Python bindings for Apple's macOS GameSave framework. It is part of the larger PyObjC bridge, which allows Python scripts to use and extend Objective-C class libraries, primarily the Cocoa frameworks. The library is actively maintained, with releases frequently aligning with new macOS SDK versions, and its current version is 12.1.

Warnings

Install

Imports

Quickstart

This example demonstrates how to import and instantiate `GSGameSaveManager`, a core class from the GameSave framework, using PyObjC. It follows the common Objective-C `alloc().init()` pattern for object creation and prints the object's description. Note that actual GameSave operations might require a running macOS application context or specific entitlements.

from GameSave import GSGameSaveManager
from Foundation import NSObject # Common base class for Objective-C objects


def main():
    print('Attempting to interact with GSGameSaveManager...')
    # In Objective-C, objects are typically allocated then initialized.
    # PyObjC follows this pattern for many Cocoa classes.
    try:
        manager = GSGameSaveManager.alloc().init()
        print(f'Successfully initialized GSGameSaveManager: {manager.description()}.')
        # Further GameSave API calls would go here.
        # Example: manager.loadGameSavesWithCompletionHandler_(...)
    except Exception as e:
        print(f'Error initializing GSGameSaveManager: {e}')
        print('Note: GameSave framework might require specific application entitlements or context.')

if __name__ == '__main__':
    # For Cocoa applications, an event loop is often required.
    # For simple script usage, direct execution might suffice or need AppKit integration.
    # import AppKit
    # AppKit.NSApplication.sharedApplication()
    # main()
    # AppKit.NSApp.run()
    main()

view raw JSON →