PyObjC Framework - Cocoa

12.1 · active · verified Fri Apr 10

PyObjC-framework-Cocoa provides Python wrappers for the core Cocoa frameworks on macOS, including CoreFoundation, Foundation, and AppKit. It acts as a bidirectional bridge, enabling Python developers to leverage Objective-C libraries and build full-featured macOS applications. Version 12.1 is currently available, with the project demonstrating active and sustainable maintenance, receiving regular updates.

Warnings

Install

Imports

Quickstart

This simple example demonstrates importing and using a basic class (NSDate) and a function (NSLog) from the Foundation framework, showing direct interaction with Objective-C APIs via PyObjC.

import Foundation
import objc

def main():
    print(f"Current date and time: {Foundation.NSDate.date()}")
    Foundation.NSLog("Hello from PyObjC!")

if __name__ == "__main__":
    main()

view raw JSON →