CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-pyobjc-core

Python-to-Objective-C bridge providing seamless interoperability between Python and Objective-C programming languages on macOS systems.

Pending
Overview
Eval results
Files

interface-builder.mddocs/

Interface Builder Integration

Decorators and descriptors for creating Interface Builder-compatible outlets, actions, and properties, enabling seamless integration with macOS app development workflows and Xcode's Interface Builder.

Capabilities

Interface Builder Outlets

Descriptors for creating outlets that can be connected to Interface Builder elements.

def IBOutlet(name=None):
    """
    Create an Interface Builder outlet descriptor.
    
    Args:
        name (str, optional): Name for the outlet (defaults to attribute name)
        
    Returns:
        Property descriptor that can be connected in Interface Builder
    """

Interface Builder Actions

Decorator for marking methods as Interface Builder actions that can be connected to UI controls.

def IBAction(func):
    """
    Mark method as an Interface Builder action.
    
    Args:
        func: Method to mark as IBAction
        
    Returns:
        Method that can be connected to UI controls in Interface Builder
    """

Interface Builder Properties

Decorator for marking properties as inspectable in Interface Builder's attribute inspector.

def IBInspectable(prop):
    """
    Mark property as Interface Builder inspectable.
    
    Args:
        prop: Property to mark as inspectable
        
    Returns:
        Property that appears in Interface Builder's attribute inspector
    """

Interface Builder Design-Time Support

Class decorator for enabling design-time rendering in Interface Builder.

def IB_DESIGNABLE(cls):
    """
    Mark class as Interface Builder designable for design-time rendering.
    
    Args:
        cls: Class to mark as designable
        
    Returns:
        Class that can render at design-time in Interface Builder
    """

Usage Examples:

import objc
from objc import IBOutlet, IBAction, IBInspectable, IB_DESIGNABLE

@IB_DESIGNABLE
class MyViewController:
    # Interface Builder outlets
    titleLabel = IBOutlet()
    submitButton = IBOutlet("submitBtn")  # Custom name
    
    # Inspectable properties (appear in Interface Builder)
    @IBInspectable
    @property
    def cornerRadius(self):
        return self._cornerRadius
    
    @cornerRadius.setter
    def cornerRadius(self, value):
        self._cornerRadius = value
        # Update UI based on property change
    
    # Interface Builder actions
    @IBAction
    def submitButtonPressed_(self, sender):
        """Connected to button's Touch Up Inside event."""
        print(f"Button pressed: {sender}")
        self.handleSubmit()
    
    @IBAction
    def textFieldChanged_(self, sender):
        """Connected to text field's Editing Changed event."""
        self.validateInput(sender.stringValue())
    
    def handleSubmit(self):
        """Regular Python method (not an IBAction)."""
        pass

Integration with macOS Development

These decorators enable full integration with Xcode's Interface Builder:

  • IBOutlet: Creates connections between Python properties and UI elements
  • IBAction: Enables method connections to user interface events
  • IBInspectable: Exposes properties in Interface Builder's attribute inspector
  • IB_DESIGNABLE: Enables custom view rendering at design-time

This allows developers to use the visual interface design tools while implementing logic in Python, maintaining the standard macOS development workflow.

Install with Tessl CLI

npx tessl i tessl/pypi-pyobjc-core

docs

bridge-registration.md

class-enhancement.md

core-bridge.md

framework-loading.md

index.md

interface-builder.md

method-decorators.md

properties-accessors.md

protocol-support.md

pyobjctools.md

tile.json