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

bridge-registration.mddocs/

Bridge Registration and Type System

Functions for registering Python types with the bridge system and comprehensive SIMD type support, enabling seamless integration between Python data types and Objective-C collections and high-performance operations.

Capabilities

Collection Type Registration

Functions for registering Python types to work seamlessly with Objective-C collection classes.

def registerListType(type_object):
    """
    Register a list-like type for NSMutableArray proxying.
    
    Args:
        type_object: Python type that behaves like a list
        
    Enables automatic conversion between the Python type and NSMutableArray.
    """

def registerMappingType(type_object):
    """
    Register a dict-like type for NSMutableDictionary proxying.
    
    Args:
        type_object: Python type that behaves like a dictionary
        
    Enables automatic conversion between the Python type and NSMutableDictionary.
    """

def registerSetType(type_object):
    """
    Register a set-like type for NSMutableSet proxying.
    
    Args:
        type_object: Python type that behaves like a set
        
    Enables automatic conversion between the Python type and NSMutableSet.
    """

Specialized Type Registration

Functions for registering specialized Python types with corresponding Objective-C classes.

def registerDateType(type_object):
    """
    Register a date-like type for NSDate proxying.
    
    Args:
        type_object: Python type that represents dates/times
        
    Enables automatic conversion between the Python type and NSDate.
    """

def registerPathType(type_object):
    """
    Register a path-like type for filesystem path handling.
    
    Args:
        type_object: Python type that represents filesystem paths
        
    Enables proper path handling with Objective-C path-related APIs.
    """

SIMD Vector Types

Comprehensive SIMD vector types for high-performance mathematical operations.

# Integer vectors
simd_int2: type      # 2-component integer vector
simd_int3: type      # 3-component integer vector  
simd_int4: type      # 4-component integer vector
simd_uint2: type     # 2-component unsigned integer vector
simd_uint3: type     # 3-component unsigned integer vector

# Short vectors
simd_short2: type    # 2-component short vector
simd_ushort2: type   # 2-component unsigned short vector
simd_ushort3: type   # 3-component unsigned short vector
simd_ushort4: type   # 4-component unsigned short vector

# Character vectors
simd_uchar16: type   # 16-component unsigned char vector

# Float vectors
simd_float2: type    # 2-component float vector
simd_float3: type    # 3-component float vector
simd_float4: type    # 4-component float vector

# Double vectors  
simd_double2: type   # 2-component double vector
simd_double3: type   # 3-component double vector
simd_double4: type   # 4-component double vector

# Quaternions
simd_quatf: type     # Float quaternion
simd_quatd: type     # Double quaternion

# Vector aliases (compatible with Metal and other frameworks)
vector_float2: type    # Alias for simd_float2
vector_float3: type    # Alias for simd_float3
vector_float4: type    # Alias for simd_float4
vector_double2: type   # 2-component double vector
vector_double3: type   # 3-component double vector
vector_double4: type   # 4-component double vector
vector_short2: type    # 2-component short vector
vector_ushort2: type   # 2-component unsigned short vector
vector_ushort3: type   # 3-component unsigned short vector
vector_ushort4: type   # 4-component unsigned short vector
vector_int2: type      # 2-component integer vector
vector_int3: type      # 3-component integer vector
vector_int4: type      # 4-component integer vector
vector_uint2: type     # 2-component unsigned integer vector
vector_uint3: type     # 3-component unsigned integer vector
vector_uchar16: type   # 16-component unsigned char vector

SIMD Matrix Types

Matrix types for 3D graphics and mathematical operations.

# Float matrices
matrix_float2x2: type    # 2x2 float matrix
matrix_float3x3: type    # 3x3 float matrix
matrix_float4x3: type    # 4x3 float matrix
matrix_float4x4: type    # 4x4 float matrix
simd_float4x4: type      # Alias for matrix_float4x4

# Double matrices
matrix_double4x4: type   # 4x4 double matrix

Usage Examples:

import objc
from objc import (registerListType, registerMappingType, registerSetType,
                  registerDateType, simd_float3, matrix_float4x4)

# Register custom collection types
class MyCustomList:
    def __init__(self):
        self.items = []
    
    def append(self, item):
        self.items.append(item)
    
    def __len__(self):
        return len(self.items)

# Register with bridge for automatic NSMutableArray conversion
registerListType(MyCustomList)

# Register custom mapping type
class MyCustomDict:
    def __init__(self):
        self.data = {}
    
    def __setitem__(self, key, value):
        self.data[key] = value
    
    def __getitem__(self, key):
        return self.data[key]

registerMappingType(MyCustomDict)

# Using SIMD types for high-performance operations
position = simd_float3(1.0, 2.0, 3.0)  # 3D position vector

# 4x4 transformation matrix for 3D graphics
transform = matrix_float4x4([
    [1.0, 0.0, 0.0, 0.0],
    [0.0, 1.0, 0.0, 0.0], 
    [0.0, 0.0, 1.0, 0.0],
    [0.0, 0.0, 0.0, 1.0]
])

# SIMD types work seamlessly with Metal, SceneKit, and other frameworks
# that expect vectorized data types

Integration with Objective-C Frameworks

The registered types and SIMD support enable seamless integration with:

  • Collections: Automatic bridging between Python and NSArray/NSDictionary/NSSet
  • Graphics: SIMD types work with Metal, Core Graphics, and SceneKit
  • Game Development: Vector and matrix types for 3D transformations
  • Scientific Computing: High-performance mathematical operations
  • Framework APIs: Direct compatibility with framework methods expecting specific types

Type Safety and Performance

  • Automatic Conversion: Registered types are automatically converted when crossing the Python-Objective-C boundary
  • Performance Optimization: SIMD types provide hardware-accelerated operations
  • Type Validation: Bridge ensures type compatibility and proper conversion
  • Memory Efficiency: Direct memory mapping for SIMD operations where possible

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