awesome-repositories.com
博客
awesome-repositories.com

通过 AI 驱动的搜索,发现最优秀的开源仓库。

探索精选搜索开源替代品自托管软件博客网站地图
项目关于排名机制媒体报道MCP 服务器
法律隐私政策服务条款
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
·
Swinject avatar

Swinject/Swinject

0
View on GitHub↗
6,708 星标·544 分支·Swift·MIT·8 次浏览

Swinject

Swinject is a dependency injection framework for Swift that manages object creation and wiring through a centralized container. It resolves dependencies by looking up registered service types at runtime, supporting iOS, macOS, and Linux platforms.

The framework provides multiple injection patterns, including initializer injection where dependencies are passed through initializer parameters, property injection that sets resolved dependencies on stored properties after object creation, and method injection that calls methods with resolved dependencies as arguments. It handles complex dependency graphs by automatically detecting and breaking circular dependencies using lazy proxies or placeholder instances. Instance lifetimes are controlled through scope-based caching, with options for per-graph, per-container, or transient scopes.

Swinject supports modular application design by allowing service registrations to be organized into separate modules that can be loaded into a container. It also integrates with UIKit storyboards by swizzling instantiation to automatically inject dependencies into view controllers. The framework includes generic autoregistration inference, which uses Swift generics to automatically infer and register services from initializer parameter types without requiring explicit factory closures.

Features

  • Dependency Injection Frameworks - Provides a dependency injection framework that resolves and injects dependencies into Swift components using a container.
  • Swift Implementations - Manages object dependencies in Swift applications by decoupling component creation from usage, enabling testable and modular code.
  • Circular Dependency Resolvers - Detects and resolves cyclic dependencies using lazy proxies or placeholder instances during resolution.
  • iOS Application Architectures - Structures iOS applications with a clean separation of concerns, using dependency injection to wire together view controllers, services, and other components.
  • Automatic Service Registrations - Uses Swift generics to automatically infer and register services from initializer parameter types without explicit closures.
  • Testable Development - Enables testable Swift development by injecting mock dependencies instead of real implementations.
  • Initializer Injections - Injects dependencies into a component's initializer parameters when the container creates the instance.
  • Initializer Injections - Injects dependencies through initializer parameters, leveraging Swift's type system for automatic resolution.
  • Dependency Resolution - Resolves dependencies by looking up registered service types in a central container at runtime.
  • Circular Dependency Resolution - Handles dependency graphs where two or more components depend on each other, breaking the cycle automatically.
  • Modular Software Design - Organizes service registrations into separate modules that can be loaded into a container.
  • Container-Based Dependency Injection - Manages object creation and wiring by registering services and resolving them through a centralized container.
  • Scoped Service Instances - Controls whether a resolved instance is reused within a graph, across the container, or created fresh each time.
  • Scope-Based Instance Caching - Controls instance lifetimes by caching resolved objects per graph, container, or transient scope.
  • Automatic Dependency Registrations - Infers a service's registration from its initializer parameters using Swift generics, removing the need for manual factory closures.
  • Dependency Injection Factory Generators - Registers a concrete component for a service protocol using a factory closure, so the container can later resolve the dependency.
  • Direct Property Injection - Sets resolved dependencies on a component's properties after the container creates the instance.
  • Container Module Registrations - Organizes service registrations into separate modules that can be loaded into a container for modularity.
  • Method-Level Injection - Calls a method on a component with resolved dependencies as arguments.
  • Container Module Registrations - Groups related service registrations into separate modules that can be loaded into a container.
  • Dependency Injection Hooks - Swizzles UIKit's storyboard instantiation to inject dependencies into view controllers automatically.
  • Runtime Property Injection - Sets resolved dependencies on stored properties after object creation using runtime type lookup.
  • Dependency Injection - Framework for dependency injection.

Star 历史

swinject/swinject 的 Star 历史图表swinject/swinject 的 Star 历史图表

AI 搜索

探索更多 awesome 仓库

用简单的语言描述您的需求 —— AI 将根据相关性为您从数千个精选开源项目中进行排序。

Start searching with AI

常见问题解答

swinject/swinject 是做什么的?

Swinject is a dependency injection framework for Swift that manages object creation and wiring through a centralized container. It resolves dependencies by looking up registered service types at runtime, supporting iOS, macOS, and Linux platforms.

swinject/swinject 的主要功能有哪些?

swinject/swinject 的主要功能包括:Dependency Injection Frameworks, Swift Implementations, Circular Dependency Resolvers, iOS Application Architectures, Automatic Service Registrations, Testable Development, Initializer Injections, Dependency Resolution。

swinject/swinject 有哪些开源替代品?

swinject/swinject 的开源替代品包括: microsoft/tsyringe — tsyringe is a TypeScript dependency injection container and inversion of control framework. It decouples class… autofac/autofac — Autofac is a dependency injection framework and inversion of control container for .NET. It functions as a component… jeffijoe/awilix — Awilix is a JavaScript dependency injection framework and inversion of control container. It provides a centralized… inversify/inversifyjs — InversifyJS is an inversion of control framework and dependency injection library for TypeScript. It provides a… evant/kotlin-inject — Kotlin-inject is a dependency injection framework for Kotlin that utilizes compile-time code generation to construct… insertkoinio/koin — Koin is a dependency injection framework for Kotlin applications that manages object lifetimes and resolves…

Swinject 的开源替代方案

相似的开源项目,按与 Swinject 的功能重合度排序。
  • microsoft/tsyringemicrosoft 的头像

    microsoft/tsyringe

    5,960在 GitHub 上查看↗

    tsyringe is a TypeScript dependency injection container and inversion of control framework. It decouples class implementations from object creation by managing dependencies and object lifecycles using decorators and metadata. The framework features a hierarchical container system where child containers can maintain independent registration scopes and fall back to parent containers for dependency resolution. It provides a provider system that controls object longevity through singleton and transient instantiation rules. The system supports recursive constructor injection and handles circular

    TypeScriptcontainerdecoratorsdependency
    在 GitHub 上查看↗5,960
  • autofac/autofacautofac 的头像

    autofac/Autofac

    4,649在 GitHub 上查看↗

    Autofac is a dependency injection framework and inversion of control container for .NET. It functions as a component registration engine that decouples class implementations from their dependencies by injecting required services via constructors or properties. The project includes an assembly scanning library to automatically discover and register components within compiled binaries based on specific type criteria. It provides a service lifetime manager to control object memory duration using singletons, instance-per-dependency, or isolated request scopes. The framework covers a broad range

    C#autofacc-sharpdependency-injection
    在 GitHub 上查看↗4,649
  • jeffijoe/awilixjeffijoe 的头像

    jeffijoe/awilix

    4,088在 GitHub 上查看↗

    Awilix is a JavaScript dependency injection framework and inversion of control container. It provides a centralized system for registering and resolving services, decoupling application components by automating how dependencies are created and passed to the functions or classes that require them. The framework features an automatic module loader that scans the filesystem using glob patterns to register dependencies based on filenames and exports. It supports parameter-name-based injection and proxy-based resolution to manage how dependencies are delivered to constructors and functions. The s

    TypeScriptawilixdependency-injectionioc
    在 GitHub 上查看↗4,088
  • inversify/inversifyjsinversify 的头像

    inversify/InversifyJS

    12,066在 GitHub 上查看↗

    InversifyJS is an inversion of control framework and dependency injection library for TypeScript. It provides a centralized container to manage object lifecycles and automate the instantiation of classes and their dependencies. The library decouples software components by mapping unique identifiers to concrete implementations. This architecture separates object creation from business logic and allows for the replacement of real service implementations with mock objects during unit testing. The framework utilizes TypeScript decorators to provide metadata-driven injection and recursive depende

    TypeScript
    在 GitHub 上查看↗12,066
查看 Swinject 的所有 30 个替代方案→