{"id":6174,"library":"pyobjc-framework-sharedwithyou","title":"PyObjC SharedWithYou Framework","description":"pyobjc-framework-sharedwithyou provides Python wrappers for Apple's SharedWithYou 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.","status":"active","version":"12.1","language":"en","source_language":"en","source_url":"https://github.com/ronaldoussoren/pyobjc","tags":["macos","objective-c","cocoa","bindings","apple-frameworks"],"install":[{"cmd":"pip install pyobjc-framework-sharedwithyou","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core component of the PyObjC bridge.","package":"pyobjc-core","optional":false},{"reason":"Provides core bindings for SharedWithYou functionality.","package":"pyobjc-framework-SharedWithYouCore","optional":false}],"imports":[{"note":"Imports the entire SharedWithYou framework for access to its classes and functions.","symbol":"SharedWithYou","correct":"import SharedWithYou"}],"quickstart":{"code":"import Foundation\nimport SharedWithYou # Assuming SharedWithYou classes are directly exposed\n\n# This example demonstrates basic PyObjC interaction by creating a Foundation object.\n# Interactions with SharedWithYou classes would follow a similar pattern.\n\n# Create an instance of a Foundation object\nhello_string = Foundation.NSString.stringWith_('Hello from PyObjC SharedWithYou!')\nprint(f\"Created Objective-C string: {hello_string}\")\n\n# You would typically interact with SharedWithYou classes here.\n# For example, if there was a 'SWYCollaboration' class:\n# try:\n#     collaboration = SharedWithYou.SWYCollaboration.alloc().init()\n#     print(f\"Created SharedWithYou Collaboration object: {collaboration}\")\n# except AttributeError:\n#     print(\"SWYCollaboration class not found or initialized in this simple example.\")\n\nprint(\"PyObjC bridge is active and ready to interact with macOS frameworks.\")","lang":"python","description":"This quickstart demonstrates the fundamental interaction pattern with Objective-C frameworks using PyObjC, specifically showing how to import and interact with a basic Foundation object. Classes within the SharedWithYou framework would be imported and instantiated similarly through the `SharedWithYou` module."},"warnings":[{"fix":"Upgrade your Python environment to Python 3.10 or later for PyObjC 12.x. Always check `requires_python` on PyPI or the PyObjC changelog for specific version requirements.","message":"PyObjC frequently drops support for older Python versions. PyObjC 12.0 dropped support for Python 3.9, and PyObjC 11.0 dropped Python 3.8. Ensure your Python version is compatible with the PyObjC version you are installing.","severity":"breaking","affected_versions":">=11.0"},{"fix":"Review code that interacts with object initialization, especially custom subclasses or factory methods, to ensure correct reference handling. While explicit memory management is rarely needed in Python, understanding the underlying Objective-C semantics is crucial for correct behavior.","message":"PyObjC 11.1 changed how initializer methods (`init` family) are modeled, now correctly reflecting that they 'steal' a reference to `self` and return a new one, as per clang's ARC documentation. This affects object lifecycle and reference counting.","severity":"breaking","affected_versions":">=11.1"},{"fix":"If experiencing issues with `__init__` and `__new__` in custom subclasses, ensure you are on PyObjC 10.3.1 or later. If relying on PyObjC's `__new__`, avoid implementing `__init__` in that specific context.","message":"In PyObjC 10.3, the ability to call `__init__` when a class or its superclasses contain a user implementation of `__new__` was temporarily dropped, then reintroduced in 10.3.1 due to breaking popular projects. Code relying on PyObjC's provided `__new__` still cannot use `__init__` in this scenario.","severity":"breaking","affected_versions":"10.3.0"},{"fix":"Applications relying on `IMServicePlugIn` functionality will need to refactor to use alternative macOS APIs or ensure compatibility with older macOS versions and PyObjC releases.","message":"The `IMServicePlugIn` framework bindings were removed in PyObjC 10.0 because the framework was deprecated in macOS 10.13 and removed entirely in macOS 14.","severity":"breaking","affected_versions":">=10.0"},{"fix":"Exercise caution when using PyObjC with Python 3.13's experimental free-threading. Thorough testing is recommended for multi-threaded applications. The PyObjC team continues to refine this support.","message":"PyObjC 11.0 introduced experimental support for free-threading (PEP 703) in Python 3.13. While a significant advancement, it's an experimental feature and may have stability considerations.","severity":"gotcha","affected_versions":">=11.0 with Python 3.13+"},{"fix":"Avoid subclassing `NSString` or `NSMutableString` in Python. If custom string-like behavior is needed, wrap `NSString` instances or use standard Python string types instead.","message":"As of PyObjC 12.0, classes `NSString` and `NSMutableString` are marked as 'final', meaning they can no longer be subclassed from Python. Attempting to subclass them will result in crashes due to special handling within PyObjC.","severity":"gotcha","affected_versions":">=12.0"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}